-
Notifications
You must be signed in to change notification settings - Fork 598
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
Implement functional color variables part 2 [Label, ButtonTableList, ButtonInvisible, Button, Breadcrumb] #1097
Implement functional color variables part 2 [Label, ButtonTableList, ButtonInvisible, Button, Breadcrumb] #1097
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/primer/primer-components/8htXmHMPDvMSFL1MvRApCgcn3hXB |
🦋 Changeset detectedLatest commit: 7ed5269 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
.c0 background-color:function (props) { | ||
return: (0,_core.get)(props.theme,path,fallback); | ||
} | ||
|
||
.c0 background-color:function (props) { | ||
return: (0,_core.get)(props.theme,path,fallback); | ||
} | ||
|
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.
Looks like L73 of src/Label.tsx is not behaving how I'm intending...
src/Label.tsx
Outdated
@@ -70,7 +70,7 @@ const Label = styled.span< | |||
|
|||
Label.defaultProps = { | |||
theme, | |||
bg: 'gray.5', | |||
bg: get('colors.label.primary.border'), |
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 don't think this is the right way to do this - is there a correct way to reference these color vars outside of a template?
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.
These props are theme-aware. So you can pass the theme key directly. Props like bg
and color
assume you're indexing into the colors
key so you don't need to write it:
bg: get('colors.label.primary.border'), | |
bg: 'label.primary.border', |
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.
ahhh, okay, that makes sense!
@@ -54,7 +54,7 @@ const Label = styled.span< | |||
>` | |||
display: inline-block; | |||
font-weight: ${get('fontWeights.semibold')}; | |||
color: ${get('colors.white')}; | |||
color: ${get('colors.text.inverse')}; | |||
border-radius: ${get('radii.3')}; | |||
|
|||
&:hover { |
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.
Commenting here because I'm not sure how to comment on collapsed lines! L66 has a shadow value with a color but I can't find any shadow that would correspond to it - one thing I'm starting to notice is there are places that could benefit from upstream changes to primitives... is that something we want to consider?
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, upstreaming changes to Primer Primitives is part of milestone 3. In this case, I think the friction is caused by a mismatch of the Primer React and Primer CSS implementation of Label. Fixing the mismatch is probably out of scope for this PR (and potentially this epic) but it's something we should be aware of as we work towards aligning all the libraries cc @ashygee @emplums @joelhawksley
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.
@VanAnderson for now, I think these variable choices are fine.
295075c
to
4b794b3
Compare
4b794b3
to
29de1a0
Compare
29de1a0
to
a9fdcbb
Compare
a9fdcbb
to
2aa25b7
Compare
src/Breadcrumb.tsx
Outdated
display: inline-block; | ||
font-size: ${get('fontSizes.1')}; | ||
text-decoration: none; | ||
&:hover { | ||
text-decoration: underline; | ||
} | ||
&.selected { | ||
color: ${get('colors.gray.7')}; | ||
color: ${get('colors.text.secondary')}; |
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.
color: ${get('colors.text.secondary')}; | |
color: ${get('colors.text.primary')}; |
src/Label.tsx
Outdated
@@ -70,7 +70,7 @@ const Label = styled.span< | |||
|
|||
Label.defaultProps = { | |||
theme, | |||
bg: 'gray.5', | |||
bg: get('colors.label.primary.border'), |
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.
These props are theme-aware. So you can pass the theme key directly. Props like bg
and color
assume you're indexing into the colors
key so you don't need to write it:
bg: get('colors.label.primary.border'), | |
bg: 'label.primary.border', |
2aa25b7
to
56e28a2
Compare
56e28a2
to
9aed7e1
Compare
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/Button/Button.tsx
Outdated
box-shadow: ${get('buttons.default.shadow.hover')}; | ||
background-color: ${get('colors.btn.hoverBg')}; | ||
border-color: ${get('colors.btn.hoverBorder')}; | ||
box-shadow: ${get('shadows.btn.focusShadow')}, ${get('shadows.btn.insetShadow')}; |
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.
There didn't seem to be a clear mapping here for hover shadow in primer css, took my best guess 🤷♂️
f697979
to
9aed7e1
Compare
box-shadow: ${get('buttons.default.shadow.active')}; | ||
border-color: ${get('buttons.default.border.active')}; | ||
background-color: ${get('colors.btn.selectedBg')}; | ||
box-shadow: ${get('shadows.btn.shadowActive')}; |
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 think this is mapped to shadowInset in primer css, but it seemed like it would be better suited as shadowActive
breadcrumb tweaks
label tweaks
9aed7e1
to
ef7cd96
Compare
@@ -12,11 +12,11 @@ const ButtonInvisible = styled(ButtonBase)<ButtonBaseProps & ButtonSystemProps & | |||
box-shadow: none; | |||
|
|||
&:disabled { | |||
color: ${get('buttons.default.color.disabled')}; | |||
color: ${get('colors.text.disabled')}; |
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.
Line 9 of this file should use colors.text.link
Co-authored-by: Cole Bemis <colebemis@github.com>
a0096aa
to
05ec28d
Compare
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 PR updates the following components to use functional color variables in preparation for color mode support:
Part of https://github.com/github/design-systems/issues/1219