-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: separate Action Button stories
- Loading branch information
Showing
4 changed files
with
203 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { ActionButton } from "seed-design/ui/action-button"; | ||
|
||
import { IconBellFill, IconChevronRightFill } from "@daangn/react-monochrome-icon"; | ||
import { actionButtonVariantMap } from "@seed-design/recipe/actionButton"; | ||
import { SeedThemeDecorator } from "./components/decorator"; | ||
import { VariantTable } from "./components/variant-table"; | ||
|
||
const meta = { | ||
title: "Action Button Medium", | ||
component: (props) => <ActionButton size="medium" {...props} />, | ||
decorators: [SeedThemeDecorator], | ||
} satisfies Meta<typeof ActionButton>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const conditionMap = { | ||
disabled: { | ||
false: { disabled: false }, | ||
true: { disabled: true }, | ||
}, | ||
loading: { | ||
false: { loading: false }, | ||
true: { loading: true }, | ||
}, | ||
layout: { | ||
textOnly: { layout: "withText", children: "Action Button" }, | ||
iconFirst: { layout: "withText", children: "Action Button", prefixIcon: <IconBellFill /> }, | ||
iconLast: { | ||
layout: "withText", | ||
children: "Action Button", | ||
suffixIcon: <IconChevronRightFill />, | ||
}, | ||
iconOnly: { layout: "iconOnly", children: <IconBellFill /> }, | ||
}, | ||
}; | ||
|
||
const CommonStoryTemplate: Story = { | ||
args: {}, | ||
render: (args) => { | ||
const { size, ...variantMap } = actionButtonVariantMap; | ||
|
||
return ( | ||
<VariantTable | ||
Component={meta.component} | ||
variantMap={variantMap} | ||
conditionMap={conditionMap} | ||
{...args} | ||
/> | ||
); | ||
}, | ||
}; | ||
|
||
export const LightTheme = CommonStoryTemplate; | ||
|
||
export const DarkTheme = CommonStoryTemplate; | ||
|
||
export const FontScalingExtraSmall = CommonStoryTemplate; | ||
|
||
export const FontScalingExtraExtraExtraLarge = CommonStoryTemplate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { ActionButton } from "seed-design/ui/action-button"; | ||
|
||
import { IconBellFill, IconChevronRightFill } from "@daangn/react-monochrome-icon"; | ||
import { actionButtonVariantMap } from "@seed-design/recipe/actionButton"; | ||
import { SeedThemeDecorator } from "./components/decorator"; | ||
import { VariantTable } from "./components/variant-table"; | ||
|
||
const meta = { | ||
title: "Action Button Small", | ||
component: (props) => <ActionButton size="small" {...props} />, | ||
decorators: [SeedThemeDecorator], | ||
} satisfies Meta<typeof ActionButton>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const conditionMap = { | ||
disabled: { | ||
false: { disabled: false }, | ||
true: { disabled: true }, | ||
}, | ||
loading: { | ||
false: { loading: false }, | ||
true: { loading: true }, | ||
}, | ||
layout: { | ||
textOnly: { layout: "withText", children: "Action Button" }, | ||
iconFirst: { layout: "withText", children: "Action Button", prefixIcon: <IconBellFill /> }, | ||
iconLast: { | ||
layout: "withText", | ||
children: "Action Button", | ||
suffixIcon: <IconChevronRightFill />, | ||
}, | ||
iconOnly: { layout: "iconOnly", children: <IconBellFill /> }, | ||
}, | ||
}; | ||
|
||
const CommonStoryTemplate: Story = { | ||
args: {}, | ||
render: (args) => { | ||
const { size, ...variantMap } = actionButtonVariantMap; | ||
|
||
return ( | ||
<VariantTable | ||
Component={meta.component} | ||
variantMap={variantMap} | ||
conditionMap={conditionMap} | ||
{...args} | ||
/> | ||
); | ||
}, | ||
}; | ||
|
||
export const LightTheme = CommonStoryTemplate; | ||
|
||
export const DarkTheme = CommonStoryTemplate; | ||
|
||
export const FontScalingExtraSmall = CommonStoryTemplate; | ||
|
||
export const FontScalingExtraExtraExtraLarge = CommonStoryTemplate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { ActionButton } from "seed-design/ui/action-button"; | ||
|
||
import { IconBellFill, IconChevronRightFill } from "@daangn/react-monochrome-icon"; | ||
import { actionButtonVariantMap } from "@seed-design/recipe/actionButton"; | ||
import { SeedThemeDecorator } from "./components/decorator"; | ||
import { VariantTable } from "./components/variant-table"; | ||
|
||
const meta = { | ||
title: "Action Button XSmall", | ||
component: (props) => <ActionButton size="xsmall" {...props} />, | ||
decorators: [SeedThemeDecorator], | ||
} satisfies Meta<typeof ActionButton>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const conditionMap = { | ||
disabled: { | ||
false: { disabled: false }, | ||
true: { disabled: true }, | ||
}, | ||
loading: { | ||
false: { loading: false }, | ||
true: { loading: true }, | ||
}, | ||
layout: { | ||
textOnly: { layout: "withText", children: "Action Button" }, | ||
iconFirst: { layout: "withText", children: "Action Button", prefixIcon: <IconBellFill /> }, | ||
iconLast: { | ||
layout: "withText", | ||
children: "Action Button", | ||
suffixIcon: <IconChevronRightFill />, | ||
}, | ||
iconOnly: { layout: "iconOnly", children: <IconBellFill /> }, | ||
}, | ||
}; | ||
|
||
const CommonStoryTemplate: Story = { | ||
args: {}, | ||
render: (args) => { | ||
const { size, ...variantMap } = actionButtonVariantMap; | ||
|
||
return ( | ||
<VariantTable | ||
Component={meta.component} | ||
variantMap={variantMap} | ||
conditionMap={conditionMap} | ||
{...args} | ||
/> | ||
); | ||
}, | ||
}; | ||
|
||
export const LightTheme = CommonStoryTemplate; | ||
|
||
export const DarkTheme = CommonStoryTemplate; | ||
|
||
export const FontScalingExtraSmall = CommonStoryTemplate; | ||
|
||
export const FontScalingExtraExtraExtraLarge = CommonStoryTemplate; |