diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-21 18:42:19 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-21 19:24:48 +0200 |
| commit | 4581c262ca06704baaa3c0a172d509207f41f5c3 (patch) | |
| tree | 45ef2fe8eafbcb3c54d7e4bee708299da40c715c /src/components | |
| parent | 0145e687ccd49da08982f6e281ebcbdcb9ef74a7 (diff) | |
chore: complete Storybook stories
Diffstat (limited to 'src/components')
45 files changed, 362 insertions, 237 deletions
diff --git a/src/components/atoms/buttons/button-link.stories.tsx b/src/components/atoms/buttons/button-link.stories.tsx index 2e1c040..d06aff3 100644 --- a/src/components/atoms/buttons/button-link.stories.tsx +++ b/src/components/atoms/buttons/button-link.stories.tsx @@ -47,6 +47,20 @@ export default { required: false, }, }, + external: { + control: { + type: 'boolean', + }, + description: 'Determine if the link is an external link.', + table: { + category: 'Options', + defaultValue: { summary: false }, + }, + type: { + name: 'boolean', + required: false, + }, + }, kind: { control: { type: 'select', diff --git a/src/components/atoms/icons/cc-by-sa.stories.tsx b/src/components/atoms/icons/cc-by-sa.stories.tsx index f2bc8f0..4229725 100644 --- a/src/components/atoms/icons/cc-by-sa.stories.tsx +++ b/src/components/atoms/icons/cc-by-sa.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import CCBySAIcon from './cc-by-sa'; /** @@ -23,13 +22,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof CCBySAIcon>; const Template: ComponentStory<typeof CCBySAIcon> = (args) => ( diff --git a/src/components/atoms/layout/copyright.stories.tsx b/src/components/atoms/layout/copyright.stories.tsx index b988165..612b114 100644 --- a/src/components/atoms/layout/copyright.stories.tsx +++ b/src/components/atoms/layout/copyright.stories.tsx @@ -1,6 +1,5 @@ import CCBySA from '@components/atoms/icons/cc-by-sa'; import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import CopyrightComponent from './copyright'; /** @@ -39,13 +38,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof CopyrightComponent>; const Template: ComponentStory<typeof CopyrightComponent> = (args) => ( diff --git a/src/components/atoms/layout/sidebar.stories.tsx b/src/components/atoms/layout/sidebar.stories.tsx index 175af94..6876f95 100644 --- a/src/components/atoms/layout/sidebar.stories.tsx +++ b/src/components/atoms/layout/sidebar.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import SidebarComponent from './sidebar'; /** @@ -46,13 +45,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof SidebarComponent>; const Template: ComponentStory<typeof SidebarComponent> = (args) => ( diff --git a/src/components/atoms/links/sharing-link.stories.tsx b/src/components/atoms/links/sharing-link.stories.tsx index c91e938..e6bd11b 100644 --- a/src/components/atoms/links/sharing-link.stories.tsx +++ b/src/components/atoms/links/sharing-link.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import SharingLinkComponent from './sharing-link'; /** @@ -41,9 +40,7 @@ export default { } as ComponentMeta<typeof SharingLinkComponent>; const Template: ComponentStory<typeof SharingLinkComponent> = (args) => ( - <IntlProvider locale="en"> - <SharingLinkComponent {...args} /> - </IntlProvider> + <SharingLinkComponent {...args} /> ); /** diff --git a/src/components/atoms/lists/description-list-item.stories.tsx b/src/components/atoms/lists/description-list-item.stories.tsx index e05493c..c7beb0d 100644 --- a/src/components/atoms/lists/description-list-item.stories.tsx +++ b/src/components/atoms/lists/description-list-item.stories.tsx @@ -52,7 +52,7 @@ export default { description: 'The item layout.', options: ['inline', 'inline-values', 'stacked'], table: { - category: 'Styles', + category: 'Options', defaultValue: { summary: 'stacked' }, }, type: { diff --git a/src/components/atoms/lists/list.stories.tsx b/src/components/atoms/lists/list.stories.tsx index 54fdd3a..eac3cd3 100644 --- a/src/components/atoms/lists/list.stories.tsx +++ b/src/components/atoms/lists/list.stories.tsx @@ -35,6 +35,19 @@ export default { value: {}, }, }, + itemsClassName: { + control: { + type: 'text', + }, + description: 'Set additional classnames to the list items.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, kind: { control: { type: 'select', diff --git a/src/components/atoms/loaders/spinner.stories.tsx b/src/components/atoms/loaders/spinner.stories.tsx index dc577dc..1792c6c 100644 --- a/src/components/atoms/loaders/spinner.stories.tsx +++ b/src/components/atoms/loaders/spinner.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import SpinnerComponent from './spinner'; /** @@ -23,13 +22,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof SpinnerComponent>; const Template: ComponentStory<typeof SpinnerComponent> = (args) => ( diff --git a/src/components/molecules/buttons/back-to-top.stories.tsx b/src/components/molecules/buttons/back-to-top.stories.tsx index 7d4bc39..a338b8b 100644 --- a/src/components/molecules/buttons/back-to-top.stories.tsx +++ b/src/components/molecules/buttons/back-to-top.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import BackToTopComponent from './back-to-top'; /** @@ -33,13 +32,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof BackToTopComponent>; const Template: ComponentStory<typeof BackToTopComponent> = (args) => ( diff --git a/src/components/molecules/buttons/heading-button.stories.tsx b/src/components/molecules/buttons/heading-button.stories.tsx index d1b5ed4..59f7be9 100644 --- a/src/components/molecules/buttons/heading-button.stories.tsx +++ b/src/components/molecules/buttons/heading-button.stories.tsx @@ -1,3 +1,4 @@ +import headingStories from '@components/atoms/headings/heading.stories'; import { ComponentMeta, ComponentStory } from '@storybook/react'; import { useState } from 'react'; import HeadingButtonComponent from './heading-button'; diff --git a/src/components/molecules/buttons/help-button.stories.tsx b/src/components/molecules/buttons/help-button.stories.tsx index cfc603e..4968b27 100644 --- a/src/components/molecules/buttons/help-button.stories.tsx +++ b/src/components/molecules/buttons/help-button.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import HelpButtonComponent from './help-button'; /** @@ -36,13 +35,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof HelpButtonComponent>; const Template: ComponentStory<typeof HelpButtonComponent> = (args) => ( diff --git a/src/components/molecules/buttons/help-button.tsx b/src/components/molecules/buttons/help-button.tsx index e351453..ccf1ebd 100644 --- a/src/components/molecules/buttons/help-button.tsx +++ b/src/components/molecules/buttons/help-button.tsx @@ -3,12 +3,7 @@ import { forwardRef, ForwardRefRenderFunction } from 'react'; import { useIntl } from 'react-intl'; import styles from './help-button.module.scss'; -export type HelpButtonProps = Pick<ButtonProps, 'onClick'> & { - /** - * Set additional classnames to the button wrapper. - */ - className?: string; -}; +export type HelpButtonProps = Pick<ButtonProps, 'className' | 'onClick'>; /** * HelpButton component @@ -18,7 +13,7 @@ export type HelpButtonProps = Pick<ButtonProps, 'onClick'> & { const HelpButton: ForwardRefRenderFunction< HTMLButtonElement, HelpButtonProps -> = ({ className = '', onClick }, ref) => { +> = ({ className = '', ...props }, ref) => { const intl = useIntl(); const text = intl.formatMessage({ defaultMessage: 'Help', @@ -29,9 +24,9 @@ const HelpButton: ForwardRefRenderFunction< return ( <Button className={`${styles.btn} ${className}`} - onClick={onClick} ref={ref} shape="circle" + {...props} > <span className="screen-reader-text">{text}</span> <span className={styles.icon}>?</span> diff --git a/src/components/molecules/forms/labelled-field.stories.tsx b/src/components/molecules/forms/labelled-field.stories.tsx index 56eef00..795e785 100644 --- a/src/components/molecules/forms/labelled-field.stories.tsx +++ b/src/components/molecules/forms/labelled-field.stories.tsx @@ -10,6 +10,7 @@ export default { component: LabelledField, args: { disabled: false, + hideLabel: false, labelPosition: 'top', required: false, }, diff --git a/src/components/molecules/forms/select-with-tooltip.stories.tsx b/src/components/molecules/forms/select-with-tooltip.stories.tsx index d757b2b..ddf5d4c 100644 --- a/src/components/molecules/forms/select-with-tooltip.stories.tsx +++ b/src/components/molecules/forms/select-with-tooltip.stories.tsx @@ -1,6 +1,5 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { useState } from 'react'; -import { IntlProvider } from 'react-intl'; import SelectWithTooltip from './select-with-tooltip'; /** @@ -178,13 +177,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof SelectWithTooltip>; const selectOptions = [ diff --git a/src/components/molecules/images/responsive-image.stories.tsx b/src/components/molecules/images/responsive-image.stories.tsx index 4294208..ca69d4f 100644 --- a/src/components/molecules/images/responsive-image.stories.tsx +++ b/src/components/molecules/images/responsive-image.stories.tsx @@ -34,6 +34,19 @@ export default { required: false, }, }, + className: { + control: { + type: 'text', + }, + description: 'Set additional classnames to the image wrapper.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, height: { control: { type: 'number', diff --git a/src/components/molecules/layout/branding.stories.tsx b/src/components/molecules/layout/branding.stories.tsx index 1637c99..d2e0694 100644 --- a/src/components/molecules/layout/branding.stories.tsx +++ b/src/components/molecules/layout/branding.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import Branding from './branding'; /** @@ -10,6 +9,7 @@ export default { component: Branding, args: { isHome: false, + withLink: false, }, argTypes: { baseline: { @@ -72,13 +72,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof Branding>; const Template: ComponentStory<typeof Branding> = (args) => ( diff --git a/src/components/molecules/layout/code.stories.tsx b/src/components/molecules/layout/code.stories.tsx index a2a6b2c..ac0e98f 100644 --- a/src/components/molecules/layout/code.stories.tsx +++ b/src/components/molecules/layout/code.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import CodeComponent from './code'; /** @@ -70,13 +69,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof CodeComponent>; const Template: ComponentStory<typeof CodeComponent> = (args) => ( diff --git a/src/components/molecules/layout/code.tsx b/src/components/molecules/layout/code.tsx index f5b60b9..30351b9 100644 --- a/src/components/molecules/layout/code.tsx +++ b/src/components/molecules/layout/code.tsx @@ -1,38 +1,10 @@ -import usePrism, { OptionalPrismPlugin } from '@utils/hooks/use-prism'; +import usePrism, { + type OptionalPrismPlugin, + type PrismLanguage, +} from '@utils/hooks/use-prism'; import { FC, useRef } from 'react'; import styles from './code.module.scss'; -export type PrismLanguage = - | 'apacheconf' - | 'bash' - | 'css' - | 'diff' - | 'docker' - | 'editorconfig' - | 'ejs' - | 'git' - | 'graphql' - | 'html' - | 'ignore' - | 'ini' - | 'javascript' - | 'jsdoc' - | 'json' - | 'jsx' - | 'makefile' - | 'markup' - | 'php' - | 'phpdoc' - | 'regex' - | 'scss' - | 'shell-session' - | 'smarty' - | 'tcl' - | 'toml' - | 'tsx' - | 'twig' - | 'yaml'; - export type CodeProps = { /** * The code to highlight. diff --git a/src/components/molecules/layout/meta.stories.tsx b/src/components/molecules/layout/meta.stories.tsx index a1755a0..c33680f 100644 --- a/src/components/molecules/layout/meta.stories.tsx +++ b/src/components/molecules/layout/meta.stories.tsx @@ -1,3 +1,5 @@ +import descriptionListItemStories from '@components/atoms/lists/description-list-item.stories'; +import descriptionListStories from '@components/atoms/lists/description-list.stories'; import { ComponentMeta, ComponentStory } from '@storybook/react'; import MetaComponent, { MetaData } from './meta'; @@ -7,7 +9,12 @@ import MetaComponent, { MetaData } from './meta'; export default { title: 'Molecules/Layout', component: MetaComponent, + args: { + itemsLayout: 'inline-values', + withSeparator: false, + }, argTypes: { + className: descriptionListStories.argTypes?.className, data: { description: 'The page metadata.', type: { @@ -16,34 +23,23 @@ export default { value: {}, }, }, + groupClassName: descriptionListStories.argTypes?.groupClassName, itemsLayout: { - control: { - type: 'select', - }, - description: 'The items layout.', - options: ['inline', 'inline-values', 'stacked'], + ...descriptionListItemStories.argTypes?.layout, table: { - category: 'Options', + ...descriptionListItemStories.argTypes?.layout?.table, defaultValue: { summary: 'inline-values' }, }, - type: { - name: 'string', - required: false, - }, }, + labelClassName: descriptionListStories.argTypes?.labelClassName, + layout: descriptionListStories.argTypes?.layout, + valueClassName: descriptionListStories.argTypes?.valueClassName, withSeparator: { - control: { - type: 'boolean', - }, - description: 'Add a slash as separator between multiple values.', + ...descriptionListStories.argTypes?.withSeparator, table: { - category: 'Options', + ...descriptionListStories.argTypes?.withSeparator?.table, defaultValue: { summary: true }, }, - type: { - name: 'boolean', - required: true, - }, }, }, } as ComponentMeta<typeof MetaComponent>; diff --git a/src/components/molecules/layout/widget.stories.tsx b/src/components/molecules/layout/widget.stories.tsx index c113db9..dd5a30b 100644 --- a/src/components/molecules/layout/widget.stories.tsx +++ b/src/components/molecules/layout/widget.stories.tsx @@ -1,5 +1,5 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; +import headingButtonStories from '../buttons/heading-button.stories'; import Widget from './widget'; /** @@ -10,6 +10,7 @@ export default { component: Widget, args: { withBorders: false, + withScroll: false, }, argTypes: { children: { @@ -22,6 +23,19 @@ export default { required: true, }, }, + className: { + control: { + type: 'text', + }, + description: 'Set additional classnames to the widget wrapper.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, expanded: { control: { type: 'boolean', @@ -36,18 +50,7 @@ export default { required: false, }, }, - level: { - control: { - type: 'number', - min: 1, - max: 6, - }, - description: 'The heading level.', - type: { - name: 'number', - required: true, - }, - }, + level: headingButtonStories.argTypes?.level, title: { control: { type: 'text', @@ -72,14 +75,21 @@ export default { required: false, }, }, + withScroll: { + control: { + type: 'boolean', + }, + description: 'Define if the widget should be scrollable', + table: { + category: 'Options', + defaultValue: { summary: false }, + }, + type: { + name: 'boolean', + required: false, + }, + }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof Widget>; const Template: ComponentStory<typeof Widget> = (args) => <Widget {...args} />; diff --git a/src/components/molecules/modals/modal.stories.tsx b/src/components/molecules/modals/modal.stories.tsx index 55b7677..f6dd364 100644 --- a/src/components/molecules/modals/modal.stories.tsx +++ b/src/components/molecules/modals/modal.stories.tsx @@ -31,6 +31,19 @@ export default { required: false, }, }, + headingClassName: { + control: { + type: 'text', + }, + description: 'Set additional classnames to the modal heading.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, icon: { control: { type: 'select', diff --git a/src/components/molecules/nav/breadcrumb.stories.tsx b/src/components/molecules/nav/breadcrumb.stories.tsx index e26b480..cf67e60 100644 --- a/src/components/molecules/nav/breadcrumb.stories.tsx +++ b/src/components/molecules/nav/breadcrumb.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import Breadcrumb from './breadcrumb'; /** @@ -44,13 +43,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof Breadcrumb>; const Template: ComponentStory<typeof Breadcrumb> = (args) => ( diff --git a/src/components/molecules/nav/nav.stories.tsx b/src/components/molecules/nav/nav.stories.tsx index 5cef5f0..f3a29a6 100644 --- a/src/components/molecules/nav/nav.stories.tsx +++ b/src/components/molecules/nav/nav.stories.tsx @@ -1,7 +1,6 @@ import Envelop from '@components/atoms/icons/envelop'; import Home from '@components/atoms/icons/home'; import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import NavComponent, { type NavItem } from './nav'; /** @@ -73,13 +72,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof NavComponent>; const Template: ComponentStory<typeof NavComponent> = (args) => ( diff --git a/src/components/molecules/nav/pagination.stories.tsx b/src/components/molecules/nav/pagination.stories.tsx index b31c2b5..2e86db4 100644 --- a/src/components/molecules/nav/pagination.stories.tsx +++ b/src/components/molecules/nav/pagination.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import PaginationComponent from './pagination'; /** @@ -8,6 +7,10 @@ import PaginationComponent from './pagination'; export default { title: 'Molecules/Navigation/Pagination', component: PaginationComponent, + args: { + baseUrl: '/page/', + siblings: 1, + }, argTypes: { 'aria-label': { control: { @@ -95,13 +98,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof PaginationComponent>; const Template: ComponentStory<typeof PaginationComponent> = (args) => ( diff --git a/src/components/organisms/forms/comment-form.stories.tsx b/src/components/organisms/forms/comment-form.stories.tsx index 8b11df7..1a9e7b7 100644 --- a/src/components/organisms/forms/comment-form.stories.tsx +++ b/src/components/organisms/forms/comment-form.stories.tsx @@ -13,6 +13,8 @@ export default { component: CommentForm, args: { saveComment, + titleAlignment: 'left', + titleLevel: 2, }, argTypes: { className: { @@ -56,6 +58,9 @@ export default { type: null, }, description: 'A callback function to process the comment form data.', + table: { + category: 'Events', + }, type: { name: 'function', required: true, @@ -74,6 +79,21 @@ export default { required: false, }, }, + titleAlignment: { + control: { + type: 'select', + }, + description: 'The heading alignment.', + options: ['center', 'left'], + table: { + category: 'Options', + defaultValue: { summary: 'left' }, + }, + type: { + name: 'string', + required: false, + }, + }, titleLevel: { control: { type: 'number', @@ -83,6 +103,7 @@ export default { description: 'The title level (hn).', table: { category: 'Options', + defaultValue: { summary: 2 }, }, type: { name: 'number', diff --git a/src/components/organisms/forms/contact-form.stories.tsx b/src/components/organisms/forms/contact-form.stories.tsx index 39d0b71..191d448 100644 --- a/src/components/organisms/forms/contact-form.stories.tsx +++ b/src/components/organisms/forms/contact-form.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import ContactForm from './contact-form'; /** @@ -40,19 +39,15 @@ export default { type: null, }, description: 'A callback function to process the contact form data.', + table: { + category: 'Events', + }, type: { name: 'function', required: true, }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof ContactForm>; const Template: ComponentStory<typeof ContactForm> = (args) => ( diff --git a/src/components/organisms/forms/search-form.stories.tsx b/src/components/organisms/forms/search-form.stories.tsx index 6ea6122..d8c8e1e 100644 --- a/src/components/organisms/forms/search-form.stories.tsx +++ b/src/components/organisms/forms/search-form.stories.tsx @@ -39,6 +39,16 @@ export default { required: false, }, }, + searchPage: { + control: { + type: 'text', + }, + description: 'The search results page url.', + type: { + name: 'string', + required: true, + }, + }, }, } as ComponentMeta<typeof SearchForm>; diff --git a/src/components/organisms/forms/settings-form.stories.tsx b/src/components/organisms/forms/settings-form.stories.tsx index 46305e7..70e1844 100644 --- a/src/components/organisms/forms/settings-form.stories.tsx +++ b/src/components/organisms/forms/settings-form.stories.tsx @@ -8,6 +8,16 @@ export default { title: 'Organisms/Forms', component: SettingsForm, argTypes: { + ackeeStorageKey: { + control: { + type: 'text', + }, + description: 'The local storage key for Ackee setting.', + type: { + name: 'string', + required: true, + }, + }, className: { control: { type: 'text', @@ -21,6 +31,16 @@ export default { required: false, }, }, + motionStorageKey: { + control: { + type: 'text', + }, + description: 'The local storage key for reduced motion setting.', + type: { + name: 'string', + required: true, + }, + }, tooltipClassName: { control: { type: 'text', diff --git a/src/components/organisms/layout/comment.stories.tsx b/src/components/organisms/layout/comment.stories.tsx index c31b77a..c7649ab 100644 --- a/src/components/organisms/layout/comment.stories.tsx +++ b/src/components/organisms/layout/comment.stories.tsx @@ -12,6 +12,7 @@ export default { title: 'Organisms/Layout', component: CommentComponent, args: { + canReply: true, saveComment, }, argTypes: { diff --git a/src/components/organisms/layout/comments-list.stories.tsx b/src/components/organisms/layout/comments-list.stories.tsx index 4d95205..1ed159a 100644 --- a/src/components/organisms/layout/comments-list.stories.tsx +++ b/src/components/organisms/layout/comments-list.stories.tsx @@ -1,5 +1,5 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import CommentsListComponent, { Comment } from './comments-list'; +import CommentsListComponent, { type Comment } from './comments-list'; const saveComment = async () => { /** Do nothing. */ @@ -29,6 +29,8 @@ export default { depth: { control: { type: 'number', + min: 0, + max: 4, }, description: 'The maximum depth. Use `0` to not display nested comments.', type: { diff --git a/src/components/organisms/layout/header.stories.tsx b/src/components/organisms/layout/header.stories.tsx index 3ceb337..a5233ea 100644 --- a/src/components/organisms/layout/header.stories.tsx +++ b/src/components/organisms/layout/header.stories.tsx @@ -92,6 +92,16 @@ export default { required: true, }, }, + searchPage: { + control: { + type: 'text', + }, + description: 'The search results page url.', + type: { + name: 'string', + required: true, + }, + }, title: { control: { type: 'text', diff --git a/src/components/organisms/layout/posts-list.stories.tsx b/src/components/organisms/layout/posts-list.stories.tsx index 77318f4..96fb2f0 100644 --- a/src/components/organisms/layout/posts-list.stories.tsx +++ b/src/components/organisms/layout/posts-list.stories.tsx @@ -10,10 +10,26 @@ export default { args: { byYear: false, isLoading: false, + pageNumber: 1, showLoadMoreBtn: false, + siblings: 1, titleLevel: 2, }, argTypes: { + baseUrl: { + control: { + type: 'text', + }, + description: 'The pagination base url.', + table: { + category: 'Options', + defaultValue: { summary: '/page/' }, + }, + type: { + name: 'string', + required: false, + }, + }, byYear: { control: { type: 'boolean', @@ -55,6 +71,20 @@ export default { required: false, }, }, + pageNumber: { + control: { + type: 'number', + }, + description: 'The current page number.', + table: { + category: 'Options', + defaultValue: { summary: 1 }, + }, + type: { + name: 'number', + required: false, + }, + }, posts: { description: 'The posts data.', type: { @@ -77,6 +107,20 @@ export default { required: false, }, }, + siblings: { + control: { + type: 'number', + }, + description: 'The number of page siblings inside pagination.', + table: { + category: 'Options', + defaultValue: { summary: 1 }, + }, + type: { + name: 'number', + required: false, + }, + }, titleLevel: { control: { type: 'number', diff --git a/src/components/organisms/modals/search-modal.stories.tsx b/src/components/organisms/modals/search-modal.stories.tsx index f40696c..5a607c6 100644 --- a/src/components/organisms/modals/search-modal.stories.tsx +++ b/src/components/organisms/modals/search-modal.stories.tsx @@ -24,6 +24,16 @@ export default { required: false, }, }, + searchPage: { + control: { + type: 'text', + }, + description: 'The search results page url.', + type: { + name: 'string', + required: true, + }, + }, }, } as ComponentMeta<typeof SearchModal>; diff --git a/src/components/organisms/modals/settings-modal.stories.tsx b/src/components/organisms/modals/settings-modal.stories.tsx index 0fe8c18..d263e2b 100644 --- a/src/components/organisms/modals/settings-modal.stories.tsx +++ b/src/components/organisms/modals/settings-modal.stories.tsx @@ -8,6 +8,16 @@ export default { title: 'Organisms/Modals', component: SettingsModal, argTypes: { + ackeeStorageKey: { + control: { + type: 'text', + }, + description: 'A local storage key for Ackee.', + type: { + name: 'string', + required: true, + }, + }, className: { control: { type: 'text', @@ -21,6 +31,16 @@ export default { required: false, }, }, + motionStorageKey: { + control: { + type: 'text', + }, + description: 'A local storage key for reduced motion setting..', + type: { + name: 'string', + required: true, + }, + }, tooltipClassName: { control: { type: 'text', diff --git a/src/components/organisms/toolbar/main-nav.stories.tsx b/src/components/organisms/toolbar/main-nav.stories.tsx index 04b22cb..831636f 100644 --- a/src/components/organisms/toolbar/main-nav.stories.tsx +++ b/src/components/organisms/toolbar/main-nav.stories.tsx @@ -1,6 +1,5 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { useState } from 'react'; -import { IntlProvider } from 'react-intl'; import MainNav from './main-nav'; /** @@ -46,19 +45,15 @@ export default { type: null, }, description: 'A callback function to change main nav state.', + table: { + category: 'Events', + }, type: { name: 'function', required: true, }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof MainNav>; const Template: ComponentStory<typeof MainNav> = ({ diff --git a/src/components/organisms/toolbar/search.stories.tsx b/src/components/organisms/toolbar/search.stories.tsx index 6aaffde..f0f65b4 100644 --- a/src/components/organisms/toolbar/search.stories.tsx +++ b/src/components/organisms/toolbar/search.stories.tsx @@ -35,11 +35,24 @@ export default { required: true, }, }, + searchPage: { + control: { + type: 'text', + }, + description: 'The search results page url.', + type: { + name: 'string', + required: true, + }, + }, setIsActive: { control: { type: null, }, description: 'A callback function to update modal state.', + table: { + category: 'Events', + }, type: { name: 'function', required: true, diff --git a/src/components/organisms/toolbar/settings.stories.tsx b/src/components/organisms/toolbar/settings.stories.tsx index 9d04932..08ec579 100644 --- a/src/components/organisms/toolbar/settings.stories.tsx +++ b/src/components/organisms/toolbar/settings.stories.tsx @@ -41,6 +41,9 @@ export default { type: null, }, description: 'Define the modal state: either opened or closed.', + table: { + category: 'Events', + }, type: { name: 'boolean', required: true, diff --git a/src/components/organisms/toolbar/settings.tsx b/src/components/organisms/toolbar/settings.tsx index 9985ba0..f558eb7 100644 --- a/src/components/organisms/toolbar/settings.tsx +++ b/src/components/organisms/toolbar/settings.tsx @@ -9,14 +9,7 @@ import SettingsModal, { import settingsStyles from './settings.module.scss'; import sharedStyles from './toolbar-items.module.scss'; -export type SettingsProps = Pick< - SettingsModalProps, - 'ackeeStorageKey' | 'motionStorageKey' | 'tooltipClassName' -> & { - /** - * Set additional classnames to the modal wrapper. - */ - className?: string; +export type SettingsProps = SettingsModalProps & { /** * The button state. */ diff --git a/src/components/organisms/toolbar/toolbar.stories.tsx b/src/components/organisms/toolbar/toolbar.stories.tsx index 1f07e79..d613442 100644 --- a/src/components/organisms/toolbar/toolbar.stories.tsx +++ b/src/components/organisms/toolbar/toolbar.stories.tsx @@ -54,6 +54,16 @@ export default { value: {}, }, }, + searchPage: { + control: { + type: 'text', + }, + description: 'The search results page url.', + type: { + name: 'string', + required: true, + }, + }, }, parameters: { layout: 'fullscreen', diff --git a/src/components/organisms/widgets/image-widget.stories.tsx b/src/components/organisms/widgets/image-widget.stories.tsx index 3014b36..fa39745 100644 --- a/src/components/organisms/widgets/image-widget.stories.tsx +++ b/src/components/organisms/widgets/image-widget.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import ImageWidget from './image-widget'; /** @@ -27,6 +26,19 @@ export default { required: false, }, }, + className: { + control: { + type: 'text', + }, + description: 'Set additional classnames to the widget wrapper.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, description: { control: { type: 'text', @@ -107,13 +119,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof ImageWidget>; const Template: ComponentStory<typeof ImageWidget> = (args) => ( diff --git a/src/components/organisms/widgets/links-list-widget.stories.tsx b/src/components/organisms/widgets/links-list-widget.stories.tsx index 0f03a2c..cdfa96a 100644 --- a/src/components/organisms/widgets/links-list-widget.stories.tsx +++ b/src/components/organisms/widgets/links-list-widget.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import LinksListWidget from './links-list-widget'; /** @@ -12,6 +11,19 @@ export default { kind: 'unordered', }, argTypes: { + className: { + control: { + type: 'text', + }, + description: 'Set additional classnames to the list wrapper.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, items: { description: 'The widget data.', type: { @@ -58,13 +70,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof LinksListWidget>; const Template: ComponentStory<typeof LinksListWidget> = (args) => ( diff --git a/src/components/organisms/widgets/social-media.stories.tsx b/src/components/organisms/widgets/social-media.stories.tsx index 2fa8bd7..6c9de4d 100644 --- a/src/components/organisms/widgets/social-media.stories.tsx +++ b/src/components/organisms/widgets/social-media.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import SocialMediaWidget, { Media } from './social-media'; /** @@ -40,13 +39,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof SocialMediaWidget>; const Template: ComponentStory<typeof SocialMediaWidget> = (args) => ( diff --git a/src/components/organisms/widgets/table-of-contents.stories.tsx b/src/components/organisms/widgets/table-of-contents.stories.tsx index fba7c54..d8b3af7 100644 --- a/src/components/organisms/widgets/table-of-contents.stories.tsx +++ b/src/components/organisms/widgets/table-of-contents.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { IntlProvider } from 'react-intl'; import ToCWidget from './table-of-contents'; /** @@ -21,13 +20,6 @@ export default { }, }, }, - decorators: [ - (Story) => ( - <IntlProvider locale="en"> - <Story /> - </IntlProvider> - ), - ], } as ComponentMeta<typeof ToCWidget>; const Template: ComponentStory<typeof ToCWidget> = (args) => ( diff --git a/src/components/templates/layout/layout.stories.tsx b/src/components/templates/layout/layout.stories.tsx index 105e808..4666b07 100644 --- a/src/components/templates/layout/layout.stories.tsx +++ b/src/components/templates/layout/layout.stories.tsx @@ -60,6 +60,32 @@ export default { required: false, }, }, + useGrid: { + control: { + type: 'boolean', + }, + description: 'Use the grid layout.', + table: { + category: 'Options', + }, + type: { + name: 'boolean', + required: false, + }, + }, + withExtraPadding: { + control: { + type: 'boolean', + }, + description: 'Set additional padding at the bottom of the page.', + table: { + category: 'Options', + }, + type: { + name: 'boolean', + required: false, + }, + }, }, decorators: [ (Story) => ( diff --git a/src/components/templates/page/page-layout.stories.tsx b/src/components/templates/page/page-layout.stories.tsx index bec1066..12fe26a 100644 --- a/src/components/templates/page/page-layout.stories.tsx +++ b/src/components/templates/page/page-layout.stories.tsx @@ -33,6 +33,30 @@ export default { required: false, }, }, + bodyAttributes: { + description: 'Set additional HTML attributes to the main content body.', + table: { + category: 'Options', + }, + type: { + name: 'object', + required: false, + value: {}, + }, + }, + bodyClassName: { + control: { + type: 'text', + }, + description: 'Set additional classnames to the main content body.', + table: { + category: 'Styles', + }, + type: { + name: 'string', + required: false, + }, + }, breadcrumb: { description: 'The breadcrumb items.', type: { |
