Skip to content

Commit 2a912fb

Browse files
committed
docs(ui): add stories for Privacy page
1 parent e2a7b59 commit 2a912fb

File tree

6 files changed

+44
-32
lines changed

6 files changed

+44
-32
lines changed

.storybook/decorators.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import AppFooter from '~/components/AppFooter.vue'
2+
import AppHeader from '~/components/AppHeader.vue'
3+
4+
/**
5+
* Wraps a page story with the standard site chrome: AppHeader, main content
6+
* area, and AppFooter. Use this for any full-page story so the layout stays
7+
* consistent and changes only need to be made in one place.
8+
*/
9+
export const pageDecorator = () => ({
10+
components: { AppHeader, AppFooter },
11+
template: `
12+
<div class="min-h-screen flex flex-col bg-bg text-fg">
13+
<AppHeader />
14+
<div id="main-content" class="flex-1 flex flex-col" tabindex="-1">
15+
<story />
16+
</div>
17+
<AppFooter />
18+
</div>
19+
`,
20+
})

app/pages/about.stories.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,13 @@
11
import About from './about.vue'
22
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
3-
import AppHeader from '~/components/AppHeader.vue'
4-
import AppFooter from '~/components/AppFooter.vue'
3+
import { pageDecorator } from '#storybook/decorators'
54

65
const meta = {
76
component: About,
87
parameters: {
98
layout: 'fullscreen',
109
},
11-
decorators: [
12-
() => ({
13-
components: { AppHeader, AppFooter },
14-
template: `
15-
<div class="min-h-screen flex flex-col bg-bg text-fg">
16-
<AppHeader :show-logo="true" />
17-
<div id="main-content" class="flex-1 flex flex-col" tabindex="-1">
18-
<story />
19-
</div>
20-
<AppFooter />
21-
</div>
22-
`,
23-
}),
24-
],
10+
decorators: [pageDecorator],
2511
} satisfies Meta<typeof About>
2612

2713
export default meta

app/pages/accessibility.stories.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,13 @@
11
import Accessibility from './accessibility.vue'
22
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
3-
import AppHeader from '~/components/AppHeader.vue'
4-
import AppFooter from '~/components/AppFooter.vue'
3+
import { pageDecorator } from '#storybook/decorators'
54

65
const meta = {
76
component: Accessibility,
87
parameters: {
98
layout: 'fullscreen',
109
},
11-
decorators: [
12-
() => ({
13-
components: { AppHeader, AppFooter },
14-
template: `
15-
<div class="min-h-screen flex flex-col bg-bg text-fg">
16-
<AppHeader :show-logo="true" />
17-
<div id="main-content" class="flex-1 flex flex-col" tabindex="-1">
18-
<story />
19-
</div>
20-
<AppFooter />
21-
</div>
22-
`,
23-
}),
24-
],
10+
decorators: [pageDecorator],
2511
} satisfies Meta<typeof Accessibility>
2612

2713
export default meta

app/pages/privacy.stories.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Privacy from './privacy.vue'
2+
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
3+
import { pageDecorator } from '#storybook/decorators'
4+
5+
const meta = {
6+
component: Privacy,
7+
parameters: {
8+
layout: 'fullscreen',
9+
},
10+
decorators: [pageDecorator],
11+
} satisfies Meta<typeof Privacy>
12+
13+
export default meta
14+
type Story = StoryObj<typeof meta>
15+
16+
export const Default: Story = {}

nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ export default defineNuxtConfig({
351351
allowImportingTsExtensions: true,
352352
paths: {
353353
'#cli/*': ['../cli/src/*'],
354+
'#storybook/*': ['../.storybook/*'],
354355
},
355356
},
356357
include: ['../test/unit/app/**/*.ts'],

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"url": "https://roe.dev"
1010
},
1111
"type": "module",
12+
"imports": {
13+
"#storybook/*": "./.storybook/*"
14+
},
1215
"scripts": {
1316
"build": "nuxt build",
1417
"build:test": "NODE_ENV=test vp run build",

0 commit comments

Comments
 (0)