-
Notifications
You must be signed in to change notification settings - Fork 47
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
🚀 feat: create new theme #723
Merged
Merged
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e6f3cf7
feat: create new tokens
tcK1 00ff94b
refactor: convert themeGenerator
tcK1 a6f2398
feat: add font resources
tcK1 566f23a
doc: add new font to docs
tcK1 db6ae26
feat: create new fw tokens
tcK1 de2f0ff
feat: create yoga3 theme
tcK1 bc5515c
refactor: remove unecessary log
tcK1 3c9dd91
fix: update fontloader logic
tcK1 ea3259d
doc: add config
tcK1 ba50375
style: codacy
tcK1 bb9c924
doc: add fonts to labnative
tcK1 da35ab7
refactor: change fonts typing
tcK1 3410c4c
refactor: use correct import
tcK1 5ff1ec8
refactor: update typing
tcK1 7d0f68f
refactor: use `Object.assign`
tcK1 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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { ThemeProvider, FontLoader } from './Provider'; | ||
import yogaTheme from './theme'; | ||
import yogaTheme, { v3theme } from './theme'; | ||
import theme from './helpers/themeReader'; | ||
import createTheme from './helpers/themeGenerator'; | ||
|
||
export { ThemeProvider as default, FontLoader, yogaTheme, theme, createTheme }; | ||
export { ThemeProvider, FontLoader, yogaTheme, theme, createTheme, v3theme }; | ||
|
||
export default ThemeProvider; |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// eslint-disable-next-line import/no-named-as-default | ||
import ThemeProvider from './Provider'; | ||
import yogaTheme from './theme'; | ||
import yogaTheme, { v3theme } from './theme'; | ||
import theme from './helpers/themeReader'; | ||
import createTheme from './helpers/themeGenerator'; | ||
|
||
export { ThemeProvider as default, yogaTheme, theme, createTheme }; | ||
export { ThemeProvider as default, yogaTheme, theme, createTheme, v3theme }; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import theme from './theme'; | ||
|
||
export { v3theme } from './v3theme'; | ||
|
||
export default theme; |
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,58 @@ | ||
import createTheme from '../helpers/themeGenerator'; | ||
|
||
export const v3theme = createTheme(tokens => ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: I think we shouldn't call it v3 as the yoga package is already on 7 :P might be confusing for who is importing it. What about something like |
||
colors: { | ||
secondary: tokens.colors.staminaNew, | ||
|
||
deep: tokens.colors.deepNew, | ||
hope: tokens.colors.hopeNew, | ||
light: tokens.colors.lightNew, | ||
clear: tokens.colors.clearNew, | ||
peace: tokens.colors.peaceNew, | ||
relax: tokens.colors.relaxNew, | ||
medium: tokens.colors.mediumNew, | ||
uplift: tokens.colors.upliftNew, | ||
stamina: tokens.colors.staminaNew, | ||
success: tokens.colors.successNew, | ||
neutral: tokens.colors.neutralNew, | ||
deepPurple: tokens.colors.deepPurpleNew, | ||
|
||
feedback: { | ||
success: { | ||
...[tokens.colors.successNew, tokens.colors.hopeNew], | ||
light: tokens.colors.successNew, | ||
dark: tokens.colors.hopeNew, | ||
}, | ||
informative: { | ||
...[tokens.colors.neutralNew, tokens.colors.relaxNew], | ||
light: tokens.colors.neutralNew, | ||
dark: tokens.colors.relaxNew, | ||
}, | ||
neutral: { | ||
...[tokens.colors.lightNew, tokens.colors.mediumNew], | ||
light: tokens.colors.lightNew, | ||
dark: tokens.colors.mediumNew, | ||
}, | ||
}, | ||
|
||
text: { | ||
primary: tokens.colors.staminaNew, | ||
secondary: tokens.colors.deepNew, | ||
disabled: tokens.colors.lightNew, | ||
}, | ||
|
||
elements: { | ||
selectionAndIcons: tokens.colors.mediumNew, | ||
lineAndBorders: tokens.colors.lightest, | ||
backgroundAndDisabled: tokens.colors.clearNew, | ||
}, | ||
}, | ||
|
||
baseFont: tokens.fonts.inter, | ||
|
||
fontWeights: { | ||
regular: tokens.fontWeights.regularNew, | ||
medium: tokens.fontWeights.mediumNew, | ||
bold: tokens.fontWeights.boldNew, | ||
}, | ||
})); |
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.
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.
potential issue: isn't this going to require changes in all the components that use the colours directly?
new
and the old. A few components already do it via avariant
prop IIRC.new
suffix, creating another potential breaking change?(there's another discussion here... should the components read the colours directly?)
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.
We are solving this with the theme: https://github.com/gympass/yoga/pull/723/files#diff-7c44dab781eac6c7c111934646f7760210c5556222abaace43c08a350788f217R7-R18
Components access the values from the theme and not the tokens directly (although they are the same in this case). As you said, using the tokens directly is probably another discussion and I agree we shouldn't be doing this, but having it inside the theme helped us keep everything using the expected colors 😄.
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.
yeah! I was thinking of just having it done on the theme itself but not exposing it via the tokens. Do you think it's worth it to "hide" these new tokens on
packages/yoga/src/Theme/theme/theme.js#theme
function?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.
Maybe in the future, as it will be a breaking change.
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.
I meant only the
new
suffixed ones 😅