Skip to content

Commit

Permalink
test(storybook): Add Wrapper component for ThemeProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
ruedap committed Jul 26, 2020
1 parent 3a694f9 commit 8e35b31
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react'
import { addDecorator } from '@storybook/react'
import { Wrapper } from './wrapper'

addDecorator(storyFn => <Wrapper>{ storyFn() }</Wrapper>)
11 changes: 11 additions & 0 deletions .storybook/wrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'
import { ThemeProvider } from 'styled-components'
import { lightTheme } from '@/styles/theme'

export const Wrapper: React.FC = ({ children }) => {
return (
<ThemeProvider theme={ lightTheme }>
{ children }
</ThemeProvider>
)
}
7 changes: 1 addition & 6 deletions components/atoms/time_svg/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import React from 'react'
import { ThemeProvider } from 'styled-components'
import { lightTheme } from '@/styles/theme'
import { TimeSvg } from '.'

export default {
title: 'components/atoms/time_svg/index',
component: TimeSvg
}

export const Default = () =>
<ThemeProvider theme={ lightTheme }>
<TimeSvg date="2020-07-26" className="foo" />
</ThemeProvider>
export const Default = () => <TimeSvg date="2020-07-26" className="foo" />

0 comments on commit 8e35b31

Please sign in to comment.