Skip to content

Commit

Permalink
chore: add story
Browse files Browse the repository at this point in the history
  • Loading branch information
TimKolberger committed Mar 9, 2022
1 parent 00d5d15 commit ab16166
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,20 @@ const withChakra = (StoryFn: Function, context: StoryContext) => {
}, [dir])

return (
<ChakraProvider theme={extendTheme({ direction: dir })}>
<ChakraProvider
theme={extendTheme({
direction: dir,
semanticTokens: {
colors: {
semantic: {
default: "red.500",
_light: "red.500",
_dark: "blue.400",
},
},
},
})}
>
<div dir={dir} id="story-wrapper" style={{ minHeight: "100vh" }}>
<ColorModeToggleBar />
<StoryFn />
Expand Down
19 changes: 19 additions & 0 deletions packages/system/stories/system.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,22 @@ export const WithCSSVarToken = () => {
</chakra.div>
)
}

export const WithSemanticTokens = () => {
return (
<div>
<chakra.p color="semantic">I am in the default color mode</chakra.p>
<div data-theme="light">
<chakra.p color="semantic">I am forced to light mode (red)</chakra.p>
</div>
<div data-theme="dark">
<chakra.p color="semantic">I am forced to dark mode (blue)</chakra.p>
<div data-theme="light">
<chakra.p pl="4" color="semantic">
I am nested and forced to light mode (red)
</chakra.p>
</div>
</div>
</div>
)
}

0 comments on commit ab16166

Please sign in to comment.