Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook adjustments #245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const config: StorybookConfig = {
__dirname,
'../../design-system/providers/**/__storybook__/stories.@(js|jsx|mjs|ts|tsx)',
),
// TODO compose wagtail stories here
],
framework: {
name: getAbsolutePath('@storybook/react-webpack5'),
Expand Down
98 changes: 0 additions & 98 deletions packages/components/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,104 +29,6 @@ const preview: Preview = {
date: /Date$/i,
},
},
options: {
// @ts-ignore
storySort: (a, b) => {
// NOTE: Storybook does not accept importing external variables for storySort,
// so the `designSystemStoriesOrder` and `componentsStoriesOrder` are defined inline.
const designSystemStoriesOrder = [
'Introduction',
'Iconography',
// Avatars
'AvatarWithPlaceholder',
'ClickableAvatar',
// Buttons
'IconButton',
// Dialogs
'BaseDialog',
'ConfirmDialog',
// Displays
'LoadingState',
// Drawers
'SwipeableDrawer',
// Popover
'Popover',
// Form
'TextField',
'TextareaField',
'CommentTextField',
// Typography
'TypographyWithEllipsis',
// General
'Logo',
'Scrollbar',
]

const componentsStoriesOrder = [
'Introduction',
'Iconography',
// Avatars
'AvatarWithPlaceholder',
'ClickableAvatar',
// Buttons
'IconButton',
// Dialogs
'BaseDialog',
'ConfirmDialog',
// Displays
'LoadingState',
// Drawers
'SwipeableDrawer',
// Popover
'Popover',
// Form
'TextField',
'TextareaField',
'CommentTextField',
// Typography
'TypographyWithEllipsis',
// General
'Logo',
'Scrollbar',

// Navigation
'NavigationLayout',
'Header',
'AccountPopover',
'NavMini',
'NavHorizontal',
'NavCentered',
'NavVertical',
//Notifications
'NotificationsModule',
'NotificationItem',
'NotificationsList',
'NotificationsPopover',
// Social
'Comments',
'CommentsList',
'CommentCreate',
'CommentUpdate',
'CommentItem',
'CommentUpsertActions',
'ReactionButton',
'Timestamp',
]
const final = [...designSystemStoriesOrder, ...componentsStoriesOrder]

const titleA = a.title || ''
const titleB = b.title || ''

const indexA = final.indexOf(titleA.split('/').pop())
const indexB = final.indexOf(titleB.split('/').pop())

if (indexA === -1 || indexB === -1) {
return titleA.localeCompare(titleB, undefined, { numeric: true })
}

return indexA - indexB
},
},
msw: {
handlers: handlers,
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ProfileSettingsComponentWithQuery from './index'
import { mockResolvers, mockResolversWithMutationError } from './mockResolver'

export default {
title: '@baseapp-frontend-template / Pages/User/Settings/AccountSettings/AccountProfile',
title: '@baseapp-frontend | components/Profiles/ProfileSettingsComponent',
component: ProfileSettingsComponentWithQuery,
decorators: [withMutationResolver],
args: {
Expand Down
47 changes: 0 additions & 47 deletions packages/design-system/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,6 @@ const preview: Preview = {
date: /Date$/i,
},
},
options: {
// @ts-ignore
storySort: (a, b) => {
const order = [
'Introduction',
'Iconography',
// Avatars
'AvatarWithPlaceholder',
'ClickableAvatar',
// Buttons
'FileUploadButton',
'IconButton',
// Dialogs
'BaseDialog',
'ConfirmDialog',
// Displays
'LoadingState',
// Drawers
'SwipeableDrawer',
// Images
'ImageWithFallback',
// Popover
'Popover',
// Form
'TextField',
'TextareaField',
'CommentTextField',
// Typography
'TypographyWithEllipsis',
// General
'Logo',
'Scrollbar',
]

const titleA = a.title || ''
const titleB = b.title || ''

const indexA = order.indexOf(titleA.split('/').pop())
const indexB = order.indexOf(titleB.split('/').pop())

if (indexA === -1 || indexB === -1) {
return titleA.localeCompare(titleB, undefined, { numeric: true })
}

return indexA - indexB
},
},
},
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meta } from '@storybook/addon-docs'

<Meta title="@baseapp-frontend / DesignSystem / Buttons / FileUploadButton" />
<Meta title="@baseapp-frontend | designSystem/Buttons/FileUploadButton" />

# Component Documentation

Expand Down
5 changes: 0 additions & 5 deletions packages/wagtail/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ const config: StorybookConfig = {
stories: [
resolve(__dirname, './*.mdx'),
resolve(__dirname, '../modules/**/__storybook__/stories.@(js|jsx|mjs|ts|tsx)'),
resolve(__dirname, '../../design-system/components/**/__storybook__/*.mdx'),
resolve(
__dirname,
'../../design-system/components/**/__storybook__/stories.@(js|jsx|mjs|ts|tsx)',
),
],
framework: {
name: getAbsolutePath('@storybook/react-webpack5'),
Expand Down
4 changes: 3 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"outputs": []
},
"storybook": {
"dependsOn": ["^storybook"]
"dependsOn": ["^build"],
"cache": false,
"persistent": true
}
}
}
Loading