-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta: separate constants and introduce extra classes per theme (#5875)
- Loading branch information
Showing
3 changed files
with
93 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Open_Sans } from 'next/font/google'; | ||
|
||
// These are the shared CSS classes between the Storybook Themes | ||
// Note: These are Tailwind Classes, and `font-open-sans` is the `open-sans` | ||
// font defined within the tailwind.config.ts config file | ||
export const COMMON_CLASSES = 'px-4 py-4 font-open-sans'; | ||
|
||
// These are the theme-specific CSS classes for Storybook Themes | ||
// Note: These are Tailwind Classes and black/white are defined within | ||
// the tailwind.config.ts config file as theme colors | ||
export const THEME_CLASSES = { | ||
dark: `${COMMON_CLASSES} bg-black text-white`, | ||
light: `${COMMON_CLASSES} bg-white text-black`, | ||
'': `${COMMON_CLASSES} bg-white text-black`, | ||
}; | ||
|
||
// This defines "execution" modes that Chromatic will run on the each Storybook Story | ||
// This allows us to test each Story with different parameters | ||
// @see https://www.chromatic.com/blog/introducing-story-modes/ | ||
export const STORYBOOK_MODES = { | ||
'dark mobile': { | ||
theme: 'dark', | ||
viewport: 'small', | ||
}, | ||
'dark desktop': { | ||
theme: 'dark', | ||
viewport: 'large', | ||
}, | ||
'light mobile': { | ||
theme: 'light', | ||
viewport: 'small', | ||
}, | ||
'light desktop': { | ||
theme: 'light', | ||
viewport: 'large', | ||
}, | ||
}; | ||
|
||
// This configures the Next.js Font for Open Sans | ||
// We then export a variable and class name to be used | ||
// within Tailwind (tailwind.config.ts) and Storybook (preview.js) | ||
export const OPEN_SANS_FONT = Open_Sans({ | ||
weight: ['300', '400', '600', '700'], | ||
display: 'fallback', | ||
subsets: ['latin'], | ||
variable: '--font-open-sans', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters