Skip to content

Commit

Permalink
Merge pull request #193 from department-of-veterans-affairs/bug/narin…
Browse files Browse the repository at this point in the history
…-fix-docs-dark-mode

[Bug] Fix dark mode on storybook web Docs pages
  • Loading branch information
narin committed Feb 22, 2024
2 parents b897824 + 0759179 commit a61d29f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
12 changes: 0 additions & 12 deletions packages/components/.storybook/web/preview.ts

This file was deleted.

25 changes: 25 additions & 0 deletions packages/components/.storybook/web/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import { DocsContainer } from '@storybook/addon-docs'
import { themes } from '@storybook/theming'
import { useDarkMode } from 'storybook-dark-mode'

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
darkMode: {
stylePreview: true,
},
docs: {
container: (props) => {
const isDark = useDarkMode()
const currentProps = { ...props }
currentProps.theme = isDark ? themes.dark : themes.light
return React.createElement(DocsContainer, currentProps)
},
},
}

0 comments on commit a61d29f

Please sign in to comment.