import type { Meta, StoryObj } from '@storybook/vue3-vite' import { ref, watch } from 'vue' import { icons as NormalIcons } from '@/assets/icons/normal.json' import VvIcon from '@/components/VvIcon/VvIcon.vue' import { argTypes, defaultArgs } from './Icon.settings' const meta: Meta = { title: 'Components/Icon/Collection', component: VvIcon, args: defaultArgs, argTypes, } export default meta type Story = StoryObj export const Default: Story = { args: { ...defaultArgs, width: 24, }, render: args => ({ components: { VvIcon }, setup() { const allIcons = Object.keys(NormalIcons) const icons = ref(allIcons) const search = ref('') watch(search, (newValue) => { icons.value = allIcons.filter(icon => icon.includes(newValue)) }) return { args, search, icons } }, template: /* html */ `
{{ iconName }}
`, }), }