import type { Meta, StoryObj } from '@storybook/vue3'
import icons from '../../../assets/icons'
import FdsBlockInfo from './FdsBlockInfo.vue'
const blockInfoTransform = (
_src: string,
storyContext: {
args?: {
heading?: string
headerInfo?: string
default?: string
icon?: string
tight?: boolean
}
},
) => {
const args = storyContext?.args || {}
const attrs = []
if (args.icon) attrs.push(`icon="${args.icon}"`)
if (args.tight) attrs.push(`:tight="true"`)
const attrsStr = attrs.length ? ` ${attrs.join(' ')}` : ''
let content = ''
if (args.headerInfo || args.default) {
content = '\n'
if (args.headerInfo) {
content += ` \n \n \n`
}
if (args.default) {
content += `
${args.default}
\n`
}
}
return `${content}`
}
const meta: Meta = {
title: 'FDS/Blocks/FdsBlockInfo',
component: FdsBlockInfo,
tags: ['autodocs'],
parameters: {
docs: {
source: {
transform: blockInfoTransform,
},
},
},
argTypes: {
heading: { control: { type: 'text' } },
iconSize: { control: { type: 'select' }, options: ['small', 'large'] },
icon: { control: { type: 'select' }, options: Object.keys(icons) },
headerInfo: {
control: { type: 'text' },
description: 'Header info slot (HTML only in Storybook, supports Vue components when consumed)',
},
default: { control: { type: 'text' } },
},
args: {
heading: 'About this component',
iconSize: 'small',
icon: undefined,
headerInfo: '',
header: 'About this component',
default:
'The Info Block can contain various types and amounts of content. We recommend using multiple instances of it for grouping related content.',
},
}
export default meta
type Story = StoryObj
export const Default: Story = {
render: (args: NonNullable) => ({
components: { FdsBlockInfo },
setup: () => ({ args }),
template: `
{{ args.default }}
`,
}),
args: {
heading: 'About this component',
default:
'The Info Block can contain various types and amounts of content. We recommend using multiple instances of it for grouping related content.',
},
}
export const WithIcon: Story = {
render: () => ({
components: { FdsBlockInfo },
template: `
The Info Block can contain various types and amounts of content. We recommend using multiple instances of it for grouping related content.
`,
}),
}
export const Secondary: Story = {
render: () => ({
components: { FdsBlockInfo },
template: `
The Info Block can contain various types and amounts of content. We recommend using multiple instances of it for grouping related content.
`,
}),
}