mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-04 15:55:44 +03:00
ca9cc86742
preview has now also a dark background & added a one click change theme button <img width="994" alt="Bildschirmfoto 2024-04-06 um 18 27 45" src="https://github.com/twentyhq/twenty/assets/48770548/95f12617-e48f-4492-9b51-13410aff43ee">
23 lines
532 B
TypeScript
23 lines
532 B
TypeScript
import { ThemeProvider } from '@emotion/react';
|
|
import { Preview } from '@storybook/react';
|
|
import { useDarkMode } from 'storybook-dark-mode';
|
|
|
|
import { THEME_DARK, THEME_LIGHT } from '../src/theme/index';
|
|
|
|
const preview: Preview = {
|
|
decorators: [
|
|
(Story) => {
|
|
const mode = useDarkMode() ? 'Dark' : 'Light';
|
|
|
|
const theme = mode === 'Dark' ? THEME_DARK : THEME_LIGHT;
|
|
return (
|
|
<ThemeProvider theme={theme}>
|
|
<Story />
|
|
</ThemeProvider>
|
|
);
|
|
},
|
|
],
|
|
};
|
|
|
|
export default preview;
|