File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed
packages/bezier-react/src/components/AlphaIcon Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ import {
2
+ ChannelBtnFilledIcon ,
3
+ type IconName ,
4
+ icons ,
5
+ } from '@channel.io/bezier-icons'
6
+ import { type Meta , type StoryObj } from '@storybook/react'
7
+
8
+ import { camelCase } from '~/src/utils/string'
9
+
10
+ import { AlphaIconButton } from '~/src/components/AlphaIconButton'
11
+ import { Stack } from '~/src/components/Stack'
12
+ import { Tooltip } from '~/src/components/Tooltip'
13
+
14
+ import { Icon } from './Icon'
15
+ import { type IconProps } from './Icon.types'
16
+
17
+ const meta : Meta < typeof Icon > = {
18
+ component : Icon ,
19
+ }
20
+
21
+ export default meta
22
+
23
+ export const Primary : StoryObj < IconProps > = {
24
+ args : {
25
+ source : ChannelBtnFilledIcon ,
26
+ size : '24' ,
27
+ color : 'fg-black-darker' ,
28
+ } ,
29
+ }
30
+
31
+ const pascalCase = ( str : string ) =>
32
+ camelCase ( str ) . replace ( / ^ ./ , ( char ) => char . toUpperCase ( ) )
33
+
34
+ const iconNames = Object . keys ( icons ) as IconName [ ]
35
+
36
+ export const IconGallery : StoryObj = {
37
+ render : ( ) => (
38
+ < Stack
39
+ direction = "horizontal"
40
+ wrap
41
+ spacing = { 16 }
42
+ padding = { 16 }
43
+ >
44
+ { iconNames . map ( ( iconName ) => (
45
+ < Stack
46
+ key = { iconName }
47
+ direction = "vertical"
48
+ align = "center"
49
+ spacing = { 4 }
50
+ width = { 40 }
51
+ height = { 40 }
52
+ borderRadius = "6"
53
+ >
54
+ < Tooltip content = { pascalCase ( iconName ) } >
55
+ < AlphaIconButton
56
+ size = "m"
57
+ content = { icons [ iconName ] }
58
+ variant = "tertiary"
59
+ color = "dark-grey"
60
+ />
61
+ </ Tooltip >
62
+ </ Stack >
63
+ ) ) }
64
+ </ Stack >
65
+ ) ,
66
+ }
You can’t perform that action at this time.
0 commit comments