import type { Meta, StoryObj } from '@storybook/react' import { colorVariants, Typography } from '../components/Typography' import { tokens } from '../theme/tokens/tokens' import { createSizeDecorator } from '../utils/decorators' import * as ArrowsIcons from './library/Arrows' import * as CommerceIcons from './library/Commerce' import * as EntertainmentIcons from './library/Entertainment' import * as InterfaceIcons from './library/Interface' import { SvgPiSymbol } from './library/Interface' import * as LivingIcons from './library/Living' import * as MailIcons from './library/Mail' import * as TechnologyIcons from './library/Technology' import * as TravelIcons from './library/Travel' 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/Legacy', component: SvgPiSymbol, decorators: [createSizeDecorator('XL')], 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: () => (
), } Colors.parameters = { themes: { defaultTheme: 'light', disable: true, }, } export const AllColors: Story = { render: () => (
{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}
)}
) })}
), } interface CategoryProps { icons: Record } const Category = ({ icons }: CategoryProps) => { return (
{Object.entries(icons).map(([name, Icon]) => (
{name}
))}
) } export const Arrows: Story = { render: () => , } export const Commerce: Story = { render: () => , } export const Entertainment: Story = { render: () => , } export const Interface: Story = { render: () => , } export const Living: Story = { render: () => , } export const Mail: Story = { render: () => , } export const Technology: Story = { render: () => , } export const Travel: Story = { render: () => , }