-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34eee9b
commit ccd65e7
Showing
4 changed files
with
136 additions
and
133 deletions.
There are no files selected for viewing
93 changes: 0 additions & 93 deletions
93
packages/smarthr-ui/src/components/Badge/Badge.stories.tsx
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
packages/smarthr-ui/src/components/Badge/VRTBadge.stories.tsx
This file was deleted.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
packages/smarthr-ui/src/components/Badge/stories/Badge.stories.tsx
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,92 @@ | ||
import React from 'react' | ||
|
||
import { Cluster, Stack } from '../../Layout' | ||
import { Text } from '../../Text' | ||
import { Badge } from '../Badge' | ||
|
||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
export default { | ||
title: 'States(状態)/Badge', | ||
component: Badge, | ||
render: (args) => <Badge {...args} />, | ||
args: { | ||
count: 0, | ||
overflowCount: 99, | ||
showZero: true, | ||
type: 'blue', | ||
dot: false, | ||
}, | ||
parameters: { | ||
chromatic: { disableSnapshot: true }, | ||
}, | ||
} as Meta<typeof Badge> | ||
|
||
export const BadgeControl: StoryObj<typeof Badge> = { | ||
name: 'Playground', | ||
args: {}, | ||
} | ||
|
||
export const Count: StoryObj<typeof Badge> = { | ||
name: 'count', | ||
render: (args) => ( | ||
<Cluster> | ||
{new Array(10).fill(0).map((_, i) => ( | ||
<Badge {...args} count={i + 1} key={i} /> | ||
))} | ||
</Cluster> | ||
), | ||
args: {}, | ||
} | ||
|
||
export const OverflowCount: StoryObj<typeof Badge> = { | ||
name: 'overflowCount', | ||
render: (args) => ( | ||
<Cluster> | ||
<Badge {...args} count={98} /> | ||
<Badge {...args} count={99} /> | ||
<Badge {...args} count={100} /> | ||
</Cluster> | ||
), | ||
args: { | ||
overflowCount: 99, | ||
}, | ||
} | ||
|
||
export const ShowZero: StoryObj<typeof Badge> = { | ||
name: 'showZero', | ||
render: (args) => ( | ||
<Stack> | ||
<Cluster> | ||
<Text>true</Text> | ||
<Badge {...args} showZero={true} count={0} /> | ||
</Cluster> | ||
<Cluster> | ||
<Text>false</Text> | ||
<Badge {...args} showZero={false} count={0} /> | ||
</Cluster> | ||
</Stack> | ||
), | ||
args: { | ||
showZero: true, | ||
}, | ||
} | ||
|
||
export const Type: StoryObj<typeof Badge> = { | ||
name: 'type', | ||
render: (args) => ( | ||
<Cluster> | ||
<Badge {...args} type="blue" /> | ||
<Badge {...args} type="yellow" /> | ||
<Badge {...args} type="red" /> | ||
<Badge {...args} type="grey" /> | ||
</Cluster> | ||
), | ||
args: {}, | ||
} | ||
|
||
export const Dot: StoryObj<typeof Badge> = { | ||
name: 'dot', | ||
render: (args) => <Badge {...args} dot={true} />, | ||
args: {}, | ||
} |
44 changes: 44 additions & 0 deletions
44
packages/smarthr-ui/src/components/Badge/stories/VRTBadge.stories.tsx
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,44 @@ | ||
import { fireEvent, within } from '@storybook/test' | ||
import React from 'react' | ||
|
||
import { Cluster, Stack } from '../../Layout' | ||
import { Badge } from '../Badge' | ||
|
||
import type { StoryObj } from '@storybook/react' | ||
|
||
export default { | ||
title: 'States(状態)/Badge/VRT', | ||
/* ペアワイズ法は使わずにすべての組み合わせを網羅する */ | ||
render: (args: any) => { | ||
const types = ['grey', 'blue', 'red', 'yellow'] as const | ||
return ( | ||
<Stack {...args} style={{ padding: '1rem' }}> | ||
{types.map((type, i) => ( | ||
<Cluster key={i}> | ||
<> | ||
<Badge type={type} count={0} showZero={false} /> | ||
<Badge type={type} count={0} showZero={true} /> | ||
<Badge type={type} count={1} /> | ||
<Badge type={type} count={10} overflowCount={10} /> | ||
<Badge type={type} count={10} overflowCount={9} /> | ||
<Badge type={type} dot={true} /> | ||
</> | ||
</Cluster> | ||
))} | ||
</Stack> | ||
) | ||
}, | ||
parameters: { | ||
chromatic: { disableSnapshot: false }, | ||
}, | ||
tags: ['!autodocs'], | ||
} | ||
|
||
export const VRT = {} | ||
|
||
export const VRTForcedColors: StoryObj = { | ||
...VRT, | ||
parameters: { | ||
chromatic: { forcedColors: 'active' }, | ||
}, | ||
} |