import type { Meta, StoryObj } from '@storybook/vue3' import { computed, ref } from 'vue' import icons from '../../assets/icons' import FdsIcon from './FdsIcon.vue' import type { FdsIconName } from './types' const meta: Meta = { title: 'FDS/FdsIcon', component: FdsIcon, tags: ['autodocs'], parameters: {}, argTypes: { name: { control: { type: 'select' }, options: Object.keys(icons) }, size: { control: { type: 'text' } }, title: { control: { type: 'text' } }, }, args: { name: (Object.keys(icons)[0] || '') as FdsIconName, size: 24, }, } export default meta type Story = StoryObj export const Basic: Story = { render: (args: Story['args']) => ({ components: { FdsIcon }, setup: () => ({ args }), template: '', }), } export const IconGallery: Story = { parameters: {}, render: (args: { name?: string; size?: number | string; title?: string }) => ({ components: { FdsIcon }, setup() { const iconEntries = ref(Object.keys(icons)) const selectedName = ref(args.name || iconEntries.value[0] || '') function onPick(n: string) { selectedName.value = n } const codeSnippet = computed(() => ``) return { args, iconEntries, onPick, codeSnippet, selectedName } }, template: `
Vald ikon: {{ selectedName }}
`, }), }