Files
Verso/services/web/frontend/stories/shared/badge.stories.tsx
T
Rebeka DekanyandCopybot cc49eeacbd Update Storybook controls for shared component stories and add Figma links for preview (#28634)
* Rename ui to shared

* Delete unused Switch component

* Update stories with Figma links

* Update Tag story naming for clarity

* Update Toggle button story naming for clarity

* Move shared components to the shared folder

* Remove file as part of TS migration

* Migrate jsx to tsx

* Remove file as part of TS migration

* Migrate jsx to tsx

* Include necessary controls only

* Auto SF

GitOrigin-RevId: d2458eeffa7a6b67ce522c3ccb6b4f71e5e76d62
2025-09-25 08:05:53 +00:00

66 lines
1.5 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/react'
import classnames from 'classnames'
import { figmaDesignUrl } from '../../../.storybook/utils/figma-design-url'
import Badge from '@/shared/components/badge/badge'
import MaterialIcon from '@/shared/components/material-icon'
const meta: Meta<typeof Badge> = {
title: 'Shared / Components / Badge',
component: Badge,
args: {
children: 'Badge',
},
argTypes: {
bg: {
options: ['light', 'info', 'primary', 'warning', 'danger'],
control: { type: 'radio' },
},
prepend: {
table: {
disable: true,
},
},
className: {
table: {
disable: true,
},
},
},
}
export default meta
type Story = StoryObj<typeof Badge>
export const BadgeDefault: Story = {
args: {
bg: meta.argTypes!.bg!.options![0],
},
parameters: figmaDesignUrl(
'https://www.figma.com/design/V7Ogph1Ocs4ux2A4WMNAh7/Overleaf---Components?node-id=3458-9502&m=dev'
),
render: args => (
<Badge
className={classnames({ 'text-dark': args.bg === 'light' })}
{...args}
/>
),
}
export const BadgePrepend: Story = {
args: {
bg: meta.argTypes!.bg!.options![0],
},
parameters: figmaDesignUrl(
'https://www.figma.com/design/V7Ogph1Ocs4ux2A4WMNAh7/Overleaf---Components?node-id=3458-11319&m=dev'
),
render: args => {
return (
<Badge
className={classnames({ 'text-dark': args.bg === 'light' })}
prepend={<MaterialIcon type="star" />}
{...args}
/>
)
},
}