Skip to content

Commit 8583007

Browse files
committed
docs(Icon): show icon identifiers in storybook grid
1 parent 3f70e3e commit 8583007

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/stories/Icons.stories.mdx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,23 @@ import icons, { DEPRECATED_ICONS } from '../components/icons'
1313
}}
1414
/>
1515

16+
export const toKebabCase = str => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
17+
1618
export const Template = args => ({
1719
components: { AIcon },
1820
setup() {
19-
return { args, icons, DEPRECATED_ICONS }
21+
const getIconId = name => `${toKebabCase(name)}-${args.size}`
22+
return { args, icons, DEPRECATED_ICONS, getIconId }
2023
},
2124
template: `
22-
<div class="grid grid-cols-5">
23-
<div class="m-4 flex items-center text-navy w-max" v-for="(icon, name) in icons.${args.size}">
24-
<a-icon :size="args.size" :name="name" />
25-
<span class="ml-3 body-md">{{name}}</span>
26-
<span v-if="DEPRECATED_ICONS[args.size].includes(name)" class="text-error body-xs-600 mx-1">(deprecated)</span>
25+
<div class="grid grid-cols-4">
26+
<div class="m-4 flex flex-col text-navy" v-for="(icon, name) in icons.${args.size}">
27+
<div class="flex items-center">
28+
<a-icon :size="args.size" :name="name" />
29+
<span class="ml-3 body-md">{{name}}</span>
30+
<span v-if="DEPRECATED_ICONS[args.size].includes(name)" class="text-error body-xs-600 mx-1">(deprecated)</span>
31+
</div>
32+
<code class="text-xs text-warsaw mt-1">{{getIconId(name)}}</code>
2733
</div>
2834
</div>
2935
`

0 commit comments

Comments
 (0)