-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[POC] Emotion Themes #387
Closed
Closed
[POC] Emotion Themes #387
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ab6f7ec
Add emotion-theming and use with Toggle component
michaeljaltamirano dea7c1d
Add emotion-theming to peerDependencies, peg version
michaeljaltamirano 9f06fb0
Add Swap Theme button
michaeljaltamirano effe460
Update snapshot
michaeljaltamirano bc85a62
Fix lockfile
michaeljaltamirano f316d78
Merge branch 'master' into poc/emotion-theming
michaeljaltamirano b358d77
WIP 2--no snapshots updated and type errors due to breaking existing …
michaeljaltamirano cdbe9d1
Lift ThemeProvider to storybook preview, add withTheme class examples…
michaeljaltamirano e8af052
Revert old color changes, fix build and build on theming conversion
michaeljaltamirano d478afa
Merge branch 'master' into poc/emotion-theming
michaeljaltamirano c6ab095
Rebuild commit
michaeljaltamirano 0984474
Push again
michaeljaltamirano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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: null, | ||
primaryTint1: '#000000', | ||
primaryTint2: null, | ||
primaryTint3: '#cccccc', | ||
secondary: '#414a4c', | ||
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,7 @@ | ||
import PRIMARY_COLORS from '../colors/primary'; | ||
|
||
export default { | ||
__type: 'primary', | ||
BOX_SHADOW: {}, | ||
COLORS: PRIMARY_COLORS, | ||
} as const; |
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,7 @@ | ||
import SECONDARY_COLORS from '../colors/secondary'; | ||
|
||
export default { | ||
__type: 'secondary', | ||
BOX_SHADOW: {}, | ||
COLORS: SECONDARY_COLORS, | ||
} as const; |
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,14 @@ | ||
import primaryTheme from './primary'; | ||
import secondaryTheme from './secondary'; | ||
|
||
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; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/constants/colors/index.ts
is unchanged to keep the diff to a minimum, but introducing full theming support would require making changes to that file as well. We'd want to disallow access toCOLORS
directly except under specific circumstances.I think our goal should be to make opting-in to the Theme as easy as possible. Personally I've already enjoyed not needing to import
COLORS
and just access it (and already typed!) off of a theme.