import type { Meta, StoryObj } from '@storybook/react' import { SvgPiSymbol, type SvgIcon } from '@chainlink/blocks-icons' import { colorVariants } from '@chainlink/blocks-icons/src/icons/iconVariants' import { Typography } from '../components' import { tokens } from '../theme/tokens/tokens' import { createSizeDecorator } from '../utils/decorators' const colorVariantsKeys = Object.keys(colorVariants) const findTokenValue = (tokenName: string) => { for (const category of Object.values(tokens)) { if (category[tokenName]) { return { light: category[tokenName].light.replace('var(--', '').replace(')', ''), dark: category[tokenName].dark.replace('var(--', '').replace(')', ''), } } } return null } const meta: Meta = { title: 'Icons', component: SvgPiSymbol, decorators: [createSizeDecorator('M')], argTypes: { color: { description: 'Allows you to set the icon color. The values for this prop correspond to blocks design system tokens.
Available colors:', control: { type: 'select', labels: colorVariantsKeys, }, value: 'foreground', options: colorVariantsKeys, table: { type: { summary: colorVariantsKeys.join(' | ') }, defaultValue: { summary: 'foreground' }, }, }, }, } satisfies Meta export default meta type Story = StoryObj export const Default: Story = { args: { color: 'progress', }, } export const Colors: Story = { render: (_args) => (
), } Colors.parameters = { themes: { defaultTheme: 'light', disable: true, }, } export const AllColors: Story = { render: (_args) => (
{Object.entries(colorVariants).map(([key, value]) => { const tokenName = value.replace('text-', '') const tokenValue = findTokenValue(tokenName) if (!tokenValue) { return null } return (
{key} --{tokenName} {tokenValue && (
{tokenValue.light}
{tokenValue.dark}
)}
) })}
), }