diff --git a/packages/go-ui-storybook/.storybook/main.ts b/packages/go-ui-storybook/.storybook/main.ts index b4587b21d..11a8f5855 100644 --- a/packages/go-ui-storybook/.storybook/main.ts +++ b/packages/go-ui-storybook/.storybook/main.ts @@ -31,7 +31,18 @@ const config: StorybookConfig = { staticDirs: ['../public'], typescript: { - reactDocgen: "react-docgen-typescript" - } + reactDocgen: 'react-docgen-typescript', + reactDocgenTypescriptOptions: { + compilerOptions: { + allowSyntheticDefaultImports: false, + esModuleInterop: false, + }, + // shouldExtractValuesFromUnion: true, + shouldExtractLiteralValuesFromEnum: true, + // Filter out third-party props from node_modules except @ifrc-go/ui package. + propFilter: (prop) => + prop.parent ? !/node_modules\/(?!@ifrc-go\/ui)/.test(prop.parent.fileName) : true, + }, + }, }; export default config; diff --git a/packages/go-ui-storybook/src/stories/DropdownMenu.stories.tsx b/packages/go-ui-storybook/src/stories/DropdownMenu.stories.tsx index d1e711b2e..6f398f442 100644 --- a/packages/go-ui-storybook/src/stories/DropdownMenu.stories.tsx +++ b/packages/go-ui-storybook/src/stories/DropdownMenu.stories.tsx @@ -1,18 +1,13 @@ -import { DropdownMenuProps } from '@ifrc-go/ui'; import type { Meta, StoryObj, } from '@storybook/react'; -import DropdownMenu from './DropdownMenu'; +import DropdownMenu, { DropdownMenuProps } from './DropdownMenu'; -type DropdownMenuSpecificProps = DropdownMenuProps & { - name: string; -}; - -type Story = StoryObj; +type Story = StoryObj; -const meta: Meta = { +const meta = { title: 'Components/DropdownMenu', component: DropdownMenu, parameters: { @@ -23,51 +18,41 @@ const meta: Meta = { }, }, tags: ['autodocs'], - decorators: [ - function Component(_, ctx) { - const componentArgs = ctx.args as DropdownMenuSpecificProps; - - return ( - - ); - }, - ], -}; +} satisfies Meta; export default meta; -export const Default: Story = { +export const Default = { args: { - label: 'Click me', - children: [
Spanish
], + label: 'Select a language', + children: [ + <> +
English
+
Spanish
+
French
+
Arabic
+ , + ], }, -}; +} satisfies Story; export const WithoutDropdownIcon: Story = { args: { - label: 'Click me', + ...Default.args, withoutDropdownIcon: true, - children: [
Spanish
], }, }; export const Persistent: Story = { args: { - label: 'Click me', + ...Default.args, persistent: true, - children: [
Spanish
], - }, }; -export const Variant: Story = { +export const WithPreferredWidth: Story = { args: { - label: 'Click me', - persistent: true, - variant: 'primary', - children: [
Spanish
], + ...Default.args, + preferredPopupWidth: 30, }, }; diff --git a/packages/go-ui-storybook/src/stories/DropdownMenu.tsx b/packages/go-ui-storybook/src/stories/DropdownMenu.tsx index dcfd889e0..ff36369e3 100644 --- a/packages/go-ui-storybook/src/stories/DropdownMenu.tsx +++ b/packages/go-ui-storybook/src/stories/DropdownMenu.tsx @@ -3,12 +3,12 @@ import { DropdownMenuProps as PureDropdownMenuProps, } from '@ifrc-go/ui'; -type DropdownMenuProps = PureDropdownMenuProps +export type DropdownMenuProps = PureDropdownMenuProps; -function WrappedDropdownMenu(props: DropdownMenuProps) { +function DropdownMenu(props: DropdownMenuProps) { return ( // eslint-disable-line react/jsx-props-no-spreading ); } -export default WrappedDropdownMenu; +export default DropdownMenu; diff --git a/packages/go-ui-storybook/src/stories/index.css b/packages/go-ui-storybook/src/stories/index.css index bb538e121..7a202ba48 100644 --- a/packages/go-ui-storybook/src/stories/index.css +++ b/packages/go-ui-storybook/src/stories/index.css @@ -41,6 +41,7 @@ } .dropdown-option { + padding: var(--go-ui-spacing-xs); margin-left: var(--go-ui-spacing-md); }