Files
crewli/apps/app/.storybook/preview.ts

43 lines
1.3 KiB
TypeScript

import type { Preview } from '@storybook/vue3-vite'
import { setup } from '@storybook/vue3-vite'
import { createMemoryHistory, createRouter } from 'vue-router'
import { installPrimeVue } from '../src/plugins/primevue'
// Side-effect: bootstrap the Tabler set so @iconify/vue <Icon> renders
// real SVG in Storybook (mirrors main.ts; preview.ts is the SB entry).
import '../src/plugins/iconify'
import '../src/assets/styles/tailwind.css'
const noop = { template: '<div />' }
const routeNames = [
'dashboard', 'events', 'organisation', 'members',
'organisation-companies', 'organisation-form-failures',
'organisation-settings', 'platform', 'platform-organisations',
'platform-users', 'platform-form-failures', 'platform-activity-log',
]
export const storyRouter = createRouter({
history: createMemoryHistory(),
routes: [
{ path: '/', name: 'home', component: noop },
...routeNames.map(name => ({ path: `/${name}`, name, component: noop })),
{ path: '/:pathMatch(.*)*', name: 'catchall', component: noop },
],
})
setup((app) => {
installPrimeVue(app)
app.use(storyRouter)
})
const preview: Preview = {
parameters: {
controls: { matchers: { color: /(background|color)$/i, date: /Date$/i } },
docs: { toc: true },
a11y: { test: 'todo' },
},
}
export default preview