-
Notifications
You must be signed in to change notification settings - Fork 48
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
c009982
commit 407e77f
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
packages/bezier-react/src/components/AlphaIcon/AlphaIcon.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,66 @@ | ||
import { | ||
ChannelBtnFilledIcon, | ||
type IconName, | ||
icons, | ||
} from '@channel.io/bezier-icons' | ||
import { type Meta, type StoryObj } from '@storybook/react' | ||
|
||
import { camelCase } from '~/src/utils/string' | ||
|
||
import { AlphaIconButton } from '~/src/components/AlphaIconButton' | ||
import { Stack } from '~/src/components/Stack' | ||
import { Tooltip } from '~/src/components/Tooltip' | ||
|
||
import { Icon } from './Icon' | ||
import { type IconProps } from './Icon.types' | ||
|
||
const meta: Meta<typeof Icon> = { | ||
component: Icon, | ||
} | ||
|
||
export default meta | ||
|
||
export const Primary: StoryObj<IconProps> = { | ||
args: { | ||
source: ChannelBtnFilledIcon, | ||
size: '24', | ||
color: 'fg-black-darker', | ||
}, | ||
} | ||
|
||
const pascalCase = (str: string) => | ||
camelCase(str).replace(/^./, (char) => char.toUpperCase()) | ||
|
||
const iconNames = Object.keys(icons) as IconName[] | ||
|
||
export const IconGallery: StoryObj = { | ||
render: () => ( | ||
<Stack | ||
direction="horizontal" | ||
wrap | ||
spacing={16} | ||
padding={16} | ||
> | ||
{iconNames.map((iconName) => ( | ||
<Stack | ||
key={iconName} | ||
direction="vertical" | ||
align="center" | ||
spacing={4} | ||
width={40} | ||
height={40} | ||
borderRadius="6" | ||
> | ||
<Tooltip content={pascalCase(iconName)}> | ||
<AlphaIconButton | ||
size="m" | ||
content={icons[iconName]} | ||
variant="tertiary" | ||
color="dark-grey" | ||
/> | ||
</Tooltip> | ||
</Stack> | ||
))} | ||
</Stack> | ||
), | ||
} |