import type { Meta, StoryObj } from '@storybook/vue3-vite' import VvAlertGroup from '@/components/VvAlertGroup/VvAlertGroup.vue' import VvButton from '@/components/VvButton/VvButton.vue' import { useAlert } from '@/composables/alert/useAlert' const meta: Meta = { title: 'Composables/useAlert', tags: ['autodocs'], } export default meta export const Default: StoryObj = { parameters: { docs: { canvas: { sourceState: 'shown', }, source: { code: ` `, }, }, }, render: args => ({ components: { VvAlertGroup, VvButton }, setup() { const { addAlert, removeAlert, alerts } = useAlert() function showSuccess() { addAlert({ title: 'Success!', modifiers: 'success', }) } function showDanger() { addAlert({ title: 'Danger!', modifiers: 'danger', }) } function showWarning() { addAlert({ title: 'Warning!', modifiers: 'warning', }) } function showInfo() { addAlert({ title: 'Info!', modifiers: 'info', }) } return { args, alerts, removeAlert, showSuccess, showDanger, showWarning, showInfo, } }, template: /* html */ `
`, }), }