-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Theme setup] Initial setup and Accordion example (#436)
* initial setup * convert Acoordion,add theme suport to stories * complete accordion example * shouldShowForEnvironment refactor * commit snapshot size * v13.0.0-alpha.1 * Replace swap button with addon-toolbars to fix visual regression Co-authored-by: Michael Altamirano <michaeljaltamirano@gmail.com>
- Loading branch information
1 parent
c2bd07f
commit 6fb4f55
Showing
17 changed files
with
921 additions
and
691 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
import COLORS from '.'; | ||
|
||
const PRIMARY_COLORS = { | ||
// brand colors | ||
primary: COLORS.purple100, | ||
primaryTint1: COLORS.purple85, | ||
primaryTint2: COLORS.purple70, | ||
primaryTint3: COLORS.purple30, | ||
secondary: COLORS.lavender100, | ||
tertiary: COLORS.purple4, | ||
|
||
// general colors | ||
success: COLORS.statusGreen, | ||
successBackground: COLORS.statusGreenBackground, | ||
successBorder: COLORS.statusGreenBorder, | ||
info: COLORS.statusPurple, | ||
infoBackground: COLORS.statusPurpleBackground, | ||
infoBorder: COLORS.statusPurpleBorder, | ||
error: COLORS.statusRed, | ||
errorBackground: COLORS.statusRedBackground, | ||
errorBorder: COLORS.statusRedBorder, | ||
default: COLORS.purple70, | ||
defaultBackground: COLORS.purple10, | ||
defaultBorder: COLORS.purple15, | ||
accent: COLORS.red, | ||
disabled: COLORS.purple10, | ||
failure: COLORS.red, | ||
hover: COLORS.purple4, | ||
warning: COLORS.yellowLight, | ||
|
||
// ui colors | ||
background: COLORS.purple4, | ||
backgroundDark: COLORS.purple4, | ||
border: COLORS.purple10, | ||
divider: COLORS.purple10, | ||
|
||
// form colors | ||
radioBorder: COLORS.purple30, | ||
radioBorderSelected: COLORS.lavender100, | ||
|
||
// typography | ||
textMuted: COLORS.purple70, | ||
textGhost: COLORS.purple30, | ||
textDisabled: COLORS.purple30, | ||
|
||
// overlay | ||
overlay: 'rgba(45, 45, 48, 0.7)', | ||
overlaySolid: 'rgba(45, 45, 48, 1)', | ||
|
||
black: COLORS.black, | ||
white: COLORS.white, | ||
}; | ||
|
||
export const PRIMARY_COLORS_PROP_TYPES = PropTypes.oneOf( | ||
Object.values(PRIMARY_COLORS), | ||
); | ||
|
||
export default PRIMARY_COLORS; |
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,60 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
import COLORS from '.'; | ||
|
||
const SECONDARY_COLORS = { | ||
// brand colors | ||
primary: '#4c0000', | ||
primaryTint1: '#b20000', | ||
primaryTint2: null, | ||
primaryTint3: '#ff0000', | ||
secondary: '#ff8000', | ||
tertiary: null, | ||
|
||
// general colors | ||
success: null, | ||
successBackground: null, | ||
successBorder: null, | ||
info: null, | ||
infoBackground: null, | ||
infoBorder: null, | ||
error: null, | ||
errorBackground: null, | ||
errorBorder: null, | ||
default: null, | ||
defaultBackground: null, | ||
defaultBorder: null, | ||
accent: null, | ||
disabled: null, | ||
failure: null, | ||
hover: null, | ||
warning: null, | ||
|
||
// ui colors | ||
background: null, | ||
backgroundDark: null, | ||
border: null, | ||
divider: null, | ||
|
||
// form colors | ||
radioBorder: null, | ||
radioBorderSelected: null, | ||
|
||
// typography | ||
textMuted: null, | ||
textGhost: null, | ||
textDisabled: null, | ||
|
||
// overlay | ||
overlay: null, | ||
overlaySolid: null, | ||
|
||
black: COLORS.black, | ||
white: COLORS.white, | ||
}; | ||
|
||
export const SECONDARY_COLORS_PROP_TYPES = PropTypes.oneOf( | ||
Object.values(SECONDARY_COLORS), | ||
); | ||
|
||
export default SECONDARY_COLORS; |
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,10 @@ | ||
import PRIMARY_COLORS from './primary'; | ||
import SECONDARY_COLORS from './secondary'; | ||
|
||
describe('theme colors', () => { | ||
it('primary and secondary colors have the same number of properties', () => { | ||
expect(Object.keys(PRIMARY_COLORS).length).toEqual( | ||
Object.keys(SECONDARY_COLORS).length, | ||
); | ||
}); | ||
}); |
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,2 @@ | ||
export { default as primaryTheme } from './primary'; | ||
export { default as secondaryTheme } from './secondary'; |
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,9 @@ | ||
import PRIMARY_COLORS from '../colors/primary'; | ||
|
||
const primaryTheme = { | ||
__type: 'primary', | ||
BOX_SHADOW: {}, | ||
COLORS: PRIMARY_COLORS, | ||
} as const; | ||
|
||
export default primaryTheme; |
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,9 @@ | ||
import SECONDARY_COLORS from '../colors/secondary'; | ||
|
||
const secondaryTheme = { | ||
__type: 'secondary', | ||
BOX_SHADOW: {}, | ||
COLORS: SECONDARY_COLORS, | ||
} as const; | ||
|
||
export default secondaryTheme; |
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,13 @@ | ||
import { primaryTheme, secondaryTheme } from '.'; | ||
|
||
type BoxShadow = | ||
| typeof primaryTheme['BOX_SHADOW'] | ||
| typeof secondaryTheme['BOX_SHADOW']; | ||
|
||
type Colors = typeof primaryTheme['COLORS'] | typeof secondaryTheme['COLORS']; | ||
|
||
export type ThemeType = { | ||
__type: 'primary' | 'secondary'; | ||
BOX_SHADOW: BoxShadow; | ||
COLORS: Colors; | ||
}; |
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
Oops, something went wrong.