-
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
[Theme] - Change Primary Buttons colors for Secondary Theme #651
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7acf6f8
change secondary theme buttons colors
daigof 07dadc7
disabled button color border
daigof e96b584
refactor out theme styles
daigof 9d3e0dd
Merge branch 'master' into button-theme-recolor
daigof 01a4e1d
Merge branch 'master' into refactor-out-types-conditional
daigof f3469d8
restore font weight position
daigof a79a181
Merge branch 'refactor-out-types-conditional' into button-theme-recolor
daigof 2206e6b
added comment
daigof 208d66a
update snapshot build
daigof 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,31 @@ | ||
import { ThemeColors, ThemeType } from '../../constants'; | ||
|
||
export const primaryButtonFontColor = (theme: ThemeType) => | ||
theme.__type === 'primary' ? theme.COLORS.white : theme.COLORS.primary; | ||
|
||
export const primaryButtonBackgroundColor = ( | ||
theme: ThemeType, | ||
buttonColor: ThemeColors, | ||
) => { | ||
if (buttonColor === theme.COLORS.primary && theme.__type === 'secondary') { | ||
return theme.COLORS.secondary; | ||
} | ||
|
||
// If buttonColor is not COLORS.primary then it is custom | ||
return buttonColor; | ||
}; | ||
|
||
export const primaryButtonLoadingBackgroundColor = (theme: ThemeType) => | ||
theme.__type === 'primary' ? theme.COLORS.white : theme.COLORS.primary; | ||
|
||
/** | ||
* We use theme.FONTS.baseFont for all primary styles, but use a | ||
* different secondary font for Display, Heading, and Title styles | ||
*/ | ||
export const setSecondaryHeadingFont = (theme: ThemeType) => | ||
theme.__type === 'secondary' ? `font-family: ${theme.FONTS.headerFont};` : ''; | ||
|
||
export const setButtonStyleFontWeight = (theme: ThemeType) => | ||
theme.__type === 'primary' | ||
? `font-weight: ${theme.TYPOGRAPHY.fontWeight.bold};` | ||
: ''; |
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.
This is great! I wonder if we should add a comment at the top of the file that explains that any ternary that is checking
theme.__type
should probably be moved into a util function in this file? (With the one exception being the Icon component, as you left it).This isn't not a blocking comment--thank you for this cleanup 🙂