Skip to content

Commit 06c82f8

Browse files
committed
Chore: export GLOBAL_DARK_CLASS_NAME constant [publish]
1 parent 26bb1e3 commit 06c82f8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

.storybook/preview.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import URLSearchParams from '@ungap/url-search-params';
66
import {Component} from '@storybook/addon-docs';
77
import {Parameters} from '@storybook/react';
88

9-
import Theme, {applyTheme} from '../src/global/theme';
9+
import Theme, {applyTheme, GLOBAL_DARK_CLASS_NAME} from '../src/global/theme';
1010

1111
import styles from './preview.css';
1212
import strictModeDecorator from './strict-mode-decorator';
@@ -47,7 +47,7 @@ export const parameters = {
4747
default: 'Light',
4848
list: [
4949
{name: 'Light', color: '#FFF'},
50-
{name: 'Dark', class: 'ring-ui-theme-dark', color: '#23272b'}
50+
{name: 'Dark', class: GLOBAL_DARK_CLASS_NAME, color: '#23272b'}
5151
]
5252
}
5353
};

src/global/theme.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Text from '../text/text';
55

66
import Select from '../select/select';
77

8-
import Theme, {ThemeProvider} from './theme';
8+
import Theme, {GLOBAL_DARK_CLASS_NAME, ThemeProvider} from './theme';
99

1010
export default {
1111
title: 'Components/Theme Provider'
@@ -29,7 +29,7 @@ const ThemedWrapper: React.FC<{children: React.ReactNode}> = ({children}) => (
2929
export const basic = () => {
3030
const ThemeExample: React.FC = () => (
3131
<div>
32-
<div className="ring-ui-theme-dark">
32+
<div className={GLOBAL_DARK_CLASS_NAME}>
3333
<ThemedWrapper>
3434
<Text>This is dark (via global css class)</Text>
3535
</ThemedWrapper>

src/global/theme.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ enum Theme {
2929

3030
export const ThemeContext = createContext<{theme: Theme.LIGHT | Theme.DARK}>({theme: Theme.LIGHT});
3131

32-
const GLOBAL_DARK_CLASS_NAME = 'ring-ui-theme-dark';
32+
export const GLOBAL_DARK_CLASS_NAME = 'ring-ui-theme-dark';
3333

3434
const darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
3535

0 commit comments

Comments
 (0)