Skip to content
Draft
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
1 change: 1 addition & 0 deletions packages/react/.storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<base href="/react/storybook/" />
34 changes: 8 additions & 26 deletions packages/react/src/stories/ThemeProvider.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {Meta, StoryFn} from '@storybook/react-vite'

import {ThemeProvider, BaseStyles, Box, useTheme} from '..'
import {ThemeProvider, BaseStyles, useTheme} from '..'
import type {ThemeProviderProps} from '../ThemeProvider'
import './ThemeProviderStories.module.css'
import classes from './ThemeProviderStories.module.css'

export default {
title: 'Behaviors/ThemeProvider',
Expand Down Expand Up @@ -41,18 +41,9 @@ Default.args = {
function NightMode() {
return (
<ThemeProvider colorMode="night">
<Box
my={3}
p={3}
color="fg.default"
bg="canvas.default"
borderWidth="1px"
borderStyle="solid"
borderColor="border.default"
borderRadius={2}
>
<div className={classes.ThemeBox}>
Always night mode (<ActiveColorScheme />)
</Box>
</div>
</ThemeProvider>
)
}
Expand All @@ -61,18 +52,9 @@ function InverseMode() {
const {resolvedColorMode} = useTheme()
return (
<ThemeProvider colorMode={resolvedColorMode === 'day' ? 'night' : 'day'}>
<Box
my={3}
p={3}
color="fg.default"
bg="canvas.default"
borderWidth="1px"
borderStyle="solid"
borderColor="border.default"
borderRadius={2}
>
<div className={classes.ThemeBox}>
Always inverse of parent mode (<ActiveColorScheme />)
</Box>
</div>
</ThemeProvider>
)
}
Expand All @@ -93,10 +75,10 @@ const AutoContents = () => {
const {colorMode, resolvedColorMode} = useTheme()

return (
<Box sx={{padding: 10, backgroundColor: 'canvas.inset', color: 'fg.default'}}>
<div className={classes.AutoContents}>
colorMode: {colorMode} <br />
resolvedColorMode: {resolvedColorMode} <br />
</Box>
</div>
)
}

Expand Down
18 changes: 18 additions & 0 deletions packages/react/src/stories/ThemeProviderStories.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
:global(body) {
background-color: var(--bgColor-default);
}

.ThemeBox {
margin-top: var(--base-size-12);
margin-bottom: var(--base-size-12);
padding: var(--base-size-12);
color: var(--fgColor-default);
background-color: var(--bgColor-default);
border-width: var(--borderWidth-thin);
border-style: solid;
border-color: var(--borderColor-default);
border-radius: var(--borderRadius-medium);
}

.AutoContents {
padding: var(--base-size-40);
background-color: var(--bgColor-inset);
color: var(--fgColor-default);
}