Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .storybook/decorators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import AppFooter from '~/components/AppFooter.vue'
import AppHeader from '~/components/AppHeader.vue'

/**
* Wraps a page story with the standard site chrome: AppHeader, main content
* area, and AppFooter. Use this for any full-page story so the layout stays
* consistent and changes only need to be made in one place.
*/
export const pageDecorator = () => ({
components: { AppHeader, AppFooter },
template: `
<div class="min-h-screen flex flex-col bg-bg text-fg">
<AppHeader />
<div id="main-content" class="flex-1 flex flex-col" tabindex="-1">
<story />
</div>
<AppFooter />
</div>
`,
})
18 changes: 2 additions & 16 deletions app/pages/about.stories.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import About from './about.vue'
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
import AppHeader from '~/components/AppHeader.vue'
import AppFooter from '~/components/AppFooter.vue'
import { pageDecorator } from '#storybook/decorators'

const meta = {
component: About,
parameters: {
layout: 'fullscreen',
},
decorators: [
() => ({
components: { AppHeader, AppFooter },
template: `
<div class="min-h-screen flex flex-col bg-bg text-fg">
<AppHeader :show-logo="true" />
<div id="main-content" class="flex-1 flex flex-col" tabindex="-1">
<story />
</div>
<AppFooter />
</div>
`,
}),
],
decorators: [pageDecorator],
} satisfies Meta<typeof About>

export default meta
Expand Down
18 changes: 2 additions & 16 deletions app/pages/accessibility.stories.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import Accessibility from './accessibility.vue'
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
import AppHeader from '~/components/AppHeader.vue'
import AppFooter from '~/components/AppFooter.vue'
import { pageDecorator } from '#storybook/decorators'

const meta = {
component: Accessibility,
parameters: {
layout: 'fullscreen',
},
decorators: [
() => ({
components: { AppHeader, AppFooter },
template: `
<div class="min-h-screen flex flex-col bg-bg text-fg">
<AppHeader :show-logo="true" />
<div id="main-content" class="flex-1 flex flex-col" tabindex="-1">
<story />
</div>
<AppFooter />
</div>
`,
}),
],
decorators: [pageDecorator],
} satisfies Meta<typeof Accessibility>

export default meta
Expand Down
16 changes: 16 additions & 0 deletions app/pages/privacy.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Privacy from './privacy.vue'
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
import { pageDecorator } from '#storybook/decorators'

const meta = {
component: Privacy,
parameters: {
layout: 'fullscreen',
},
decorators: [pageDecorator],
} satisfies Meta<typeof Privacy>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {}
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ export default defineNuxtConfig({
allowImportingTsExtensions: true,
paths: {
'#cli/*': ['../cli/src/*'],
'#storybook/*': ['../.storybook/*'],
},
},
include: ['../test/unit/app/**/*.ts'],
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"url": "https://roe.dev"
},
"type": "module",
"imports": {
"#storybook/*": "./.storybook/*"
},
"scripts": {
"build": "nuxt build",
"build:test": "NODE_ENV=test vp run build",
Expand Down
Loading