Skip to content

Commit

Permalink
test(stories): consistent composition
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Jul 19, 2024
1 parent d76d916 commit 1d0e507
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/components/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const Basic = {
} satisfies Story;

export const Types = {
...Basic,
render: () => (
<div className="flex flex-col gap-4">
<Alert type="info">Info</Alert>
Expand Down
5 changes: 5 additions & 0 deletions src/components/ButtonPlain.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const Basic = {
} satisfies Story;

export const Interactivity = {
...Basic,
render: () => (
<div className="flex flex-wrap gap-4">
<ButtonPlain>Focused</ButtonPlain>
Expand All @@ -35,6 +36,7 @@ export const Interactivity = {
} satisfies Story;

export const Sizes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonPlain size="sm">Small</ButtonPlain>
Expand All @@ -45,6 +47,7 @@ export const Sizes = {
} satisfies Story;

export const WithIcon = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonPlain size="sm" iconStart={<PlusIcon16 className="size-4" />}>
Expand All @@ -61,6 +64,7 @@ export const WithIcon = {
} satisfies Story;

export const Shapes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonPlain shape="rectangle">Rectangle</ButtonPlain>
Expand All @@ -76,6 +80,7 @@ export const Shapes = {
} satisfies Story;

export const Colors = {
...Basic,
render: () => (
<div className="flex flex-wrap gap-4">
<ButtonPlain color="neutral">Neutral</ButtonPlain>
Expand Down
5 changes: 5 additions & 0 deletions src/components/ButtonPrimary.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const Basic = {
} satisfies Story;

export const Interactivity = {
...Basic,
render: () => (
<div className="flex flex-wrap gap-4">
<ButtonPrimary>Focused</ButtonPrimary>
Expand All @@ -35,6 +36,7 @@ export const Interactivity = {
} satisfies Story;

export const Sizes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonPrimary size="sm">Small</ButtonPrimary>
Expand All @@ -45,6 +47,7 @@ export const Sizes = {
} satisfies Story;

export const WithIcon = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonPrimary size="sm" iconStart={<PlusIcon16 className="size-4" />}>
Expand All @@ -61,6 +64,7 @@ export const WithIcon = {
} satisfies Story;

export const Shapes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonPrimary shape="rectangle">Rectangle</ButtonPrimary>
Expand All @@ -76,6 +80,7 @@ export const Shapes = {
} satisfies Story;

export const Colors = {
...Basic,
render: () => (
<div className="flex flex-wrap gap-4">
<ButtonPrimary color="neutral">Neutral</ButtonPrimary>
Expand Down
5 changes: 5 additions & 0 deletions src/components/ButtonSecondary.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const Basic = {
} satisfies Story;

export const Interactivity = {
...Basic,
render: () => (
<div className="flex flex-wrap gap-4">
<ButtonSecondary>Focused</ButtonSecondary>
Expand All @@ -35,6 +36,7 @@ export const Interactivity = {
} satisfies Story;

export const Sizes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonSecondary size="sm">Small</ButtonSecondary>
Expand All @@ -45,6 +47,7 @@ export const Sizes = {
} satisfies Story;

export const WithIcon = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonSecondary size="sm" iconStart={<PlusIcon16 className="size-4" />}>
Expand All @@ -61,6 +64,7 @@ export const WithIcon = {
} satisfies Story;

export const Shapes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonSecondary shape="rectangle">Rectangle</ButtonSecondary>
Expand All @@ -76,6 +80,7 @@ export const Shapes = {
} satisfies Story;

export const Colors = {
...Basic,
render: () => (
<div className="flex flex-wrap gap-4">
<ButtonSecondary color="neutral">Neutral</ButtonSecondary>
Expand Down
5 changes: 5 additions & 0 deletions src/components/ButtonTertiary.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const Basic = {
} satisfies Story;

export const Interactivity = {
...Basic,
render: () => (
<div className="flex flex-wrap gap-4">
<ButtonTertiary>Focused</ButtonTertiary>
Expand All @@ -35,6 +36,7 @@ export const Interactivity = {
} satisfies Story;

export const Sizes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonTertiary size="sm">Small</ButtonTertiary>
Expand All @@ -45,6 +47,7 @@ export const Sizes = {
} satisfies Story;

export const WithIcon = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonTertiary size="sm" iconStart={<PlusIcon16 className="size-4" />}>
Expand All @@ -61,6 +64,7 @@ export const WithIcon = {
} satisfies Story;

export const Shapes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<ButtonTertiary shape="rectangle">Rectangle</ButtonTertiary>
Expand All @@ -76,6 +80,7 @@ export const Shapes = {
} satisfies Story;

export const Colors = {
...Basic,
render: () => (
<div className="flex flex-wrap gap-4">
<ButtonTertiary color="neutral">Neutral</ButtonTertiary>
Expand Down
32 changes: 17 additions & 15 deletions src/components/InputFilled.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ export const Basic = {
} satisfies Story;

export const Interactivity = {
args: {
placeholder: "Placeholder",
},
render: (args) => (
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<InputFilled {...args} defaultValue="Focused" />
<InputFilled {...args} defaultValue="Invalid" aria-invalid />
<InputFilled {...args} defaultValue="Read-only" readOnly />
<InputFilled {...args} placeholder="Placeholder" />
<InputFilled {...args} defaultValue="Disabled" disabled />
<InputFilled placeholder="Placeholder" defaultValue="Focused" />
<InputFilled
placeholder="Placeholder"
defaultValue="Invalid"
aria-invalid
/>
<InputFilled
placeholder="Placeholder"
defaultValue="Read-only"
readOnly
/>
<InputFilled placeholder="Placeholder" />
<InputFilled placeholder="Placeholder" defaultValue="Disabled" disabled />
</div>
),
play: async () => {
Expand All @@ -39,9 +45,7 @@ export const Interactivity = {
} satisfies Story;

export const Sizes = {
args: {
placeholder: "Placeholder",
},
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<InputFilled size="sm" placeholder="Small" />
Expand All @@ -52,9 +56,7 @@ export const Sizes = {
} satisfies Story;

export const Shapes = {
args: {
placeholder: "Placeholder",
},
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<InputFilled shape="rectangle" placeholder="Rectangle" />
Expand Down
23 changes: 19 additions & 4 deletions src/components/InputOutlined.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,26 @@ export const Basic = {
} satisfies Story;

export const Interactivity = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<InputOutlined defaultValue="Focused" />
<InputOutlined defaultValue="Invalid" aria-invalid />
<InputOutlined defaultValue="Read-only" readOnly />
<InputOutlined placeholder="Placeholder" defaultValue="Focused" />
<InputOutlined
placeholder="Placeholder"
defaultValue="Invalid"
aria-invalid
/>
<InputOutlined
placeholder="Placeholder"
defaultValue="Read-only"
readOnly
/>
<InputOutlined placeholder="Placeholder" />
<InputOutlined defaultValue="Disabled" disabled />
<InputOutlined
placeholder="Placeholder"
defaultValue="Disabled"
disabled
/>
</div>
),
play: async () => {
Expand All @@ -36,6 +49,7 @@ export const Interactivity = {
} satisfies Story;

export const Sizes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<InputOutlined size="sm" placeholder="Small" />
Expand All @@ -46,6 +60,7 @@ export const Sizes = {
} satisfies Story;

export const Shapes = {
...Basic,
render: () => (
<div className="flex flex-col items-start gap-4">
<InputOutlined shape="rectangle" placeholder="Rectangle" />
Expand Down

0 comments on commit 1d0e507

Please sign in to comment.