import type { Meta, StoryObj } from '@storybook/vue3' import FdsSticker from './FdsSticker.vue' const stickerTransform = ( _src: string, storyContext: { args?: { variant?: string; bullet?: boolean; default?: string } }, ) => { const args = storyContext?.args || {} const attrs = [] if (args.variant && args.variant !== 'blue') attrs.push(`variant="${args.variant}"`) if (args.bullet) attrs.push(`:bullet="true"`) const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : '' const content = args.default || '' return `${content}` } const meta: Meta = { title: 'FDS/FdsSticker', component: FdsSticker, tags: ['autodocs'], parameters: { docs: { source: { transform: stickerTransform, }, }, }, argTypes: { variant: { control: { type: 'radio' }, options: ['blue', 'gray', 'green', 'red', 'yellow', 't_blue'], description: 'Set the color variant of the sticker', }, bullet: { control: { type: 'boolean' }, description: 'Set the layout to bullet style', }, default: { control: { type: 'text' } }, }, args: { variant: 'blue', bullet: false, default: 'Stick it!', }, } export default meta type Story = StoryObj export const Default: Story = { render: (args: Story['args']) => ({ components: { FdsSticker }, setup: () => ({ args }), template: `{{ args.default }}`, }), args: { variant: 'blue', default: 'Stick it!', }, } export const Alert: Story = { render: () => ({ components: { FdsSticker }, template: ` Alert `, }), } export const Fail: Story = { render: () => ({ components: { FdsSticker }, template: ` Failed `, }), } export const Success: Story = { render: () => ({ components: { FdsSticker }, template: ` Success `, }), } export const Gray: Story = { render: () => ({ components: { FdsSticker }, template: ` Info `, }), } export const TransparentBlue: Story = { render: () => ({ components: { FdsSticker }, template: ` Transparent `, }), } export const BulletBlue: Story = { render: () => ({ components: { FdsSticker }, template: ` Bullet point `, }), } export const BulletGreen: Story = { render: () => ({ components: { FdsSticker }, template: ` Success bullet `, }), } export const AllVariants: Story = { render: () => ({ components: { FdsSticker }, template: ` Blue Green Red Yellow Gray Transparent Blue Blue Bullet Green Bullet Red Bullet Yellow Bullet Gray Bullet Transparent Blue Bullet `, }), }