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
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { StorybookConfig } from '@storybook-vue/nuxt'

const config = {
stories: ['../app/**/*.stories.@(js|ts)'],
stories: ['../.storybook/*.mdx', '../app/**/*.stories.@(js|ts)'],
addons: ['@storybook/addon-a11y', '@storybook/addon-docs', '@storybook/addon-themes'],
framework: '@storybook-vue/nuxt',
staticDirs: ['./.public'],
Expand Down
20 changes: 14 additions & 6 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { addons } from 'storybook/manager-api'
import { create } from 'storybook/theming'

const npmxTheme = create({
brandTitle: 'npmx Storybook',
brandImage: '/npmx-storybook.svg',
})
import npmxDark from './theme'

addons.setConfig({
theme: npmxTheme,
theme: npmxDark,
layoutCustomisations: {
showToolbar: (state, defaultValue) => {
if (state.viewMode === 'docs' && state.storyId) {
const story = state.index?.[state.storyId]
const tags = story?.tags || []
if (tags.includes('hide-toolbar')) {
return false
}
}
return defaultValue
},
},
})
6 changes: 6 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<style>
/* Override docs story canvas background to match npmx theme */
.docs-story {
background-color: var(--bg, oklch(0.171 0 0)) !important;
}
</style>
5 changes: 5 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { currentLocales } from '../config/i18n'
import { fn } from 'storybook/test'
import { ACCENT_COLORS } from '../shared/utils/constants'

import npmxDark from './theme'

// related: https://github.com/npmx-dev/npmx.dev/blob/1431d24be555bca5e1ae6264434d49ca15173c43/test/nuxt/setup.ts#L12-L26
// Stub Nuxt specific globals
// @ts-expect-error - dynamic global name
Expand All @@ -25,6 +27,9 @@ const preview: Preview = {
date: /Date$/i,
},
},
docs: {
theme: npmxDark,
},
},
// Provides toolbars to switch things like theming and language
globalTypes: {
Expand Down
7 changes: 7 additions & 0 deletions .storybook/storybook-welcome.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="Welcome" tags={['hide-toolbar']}/>

# Welcome

Welcome to the npmx Storybook.
13 changes: 13 additions & 0 deletions .storybook/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { create } from 'storybook/theming'

const npmxDark = create({
base: 'dark',

brandTitle: 'npmx Storybook',
brandImage: '/npmx-storybook.svg',

// UI
appContentBg: '#101010', // oklch(0.171 0 0)
})

export default npmxDark
Loading