Skip to content
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

Merged
merged 12 commits into from
Mar 4, 2021

Conversation

VanAnderson
Copy link
Contributor

This PR updates the following components to use functional color variables in preparation for color mode support:

  • Label
  • ButtonTableList
  • ButtonInvisible
  • Button
  • Breadcrumb

Part of https://github.com/github/design-systems/issues/1219

@vercel
Copy link

vercel bot commented Mar 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/8htXmHMPDvMSFL1MvRApCgcn3hXB
✅ Preview: https://primer-compone-git-vananderson-implement-functional-colo-05e841.vercel.app

@changeset-bot
Copy link

changeset-bot bot commented Mar 1, 2021

🦋 Changeset detected

Latest commit: 7ed5269

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/components Patch

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

Comment on lines 50 to 57
.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);
}

Copy link
Contributor Author

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'),
Copy link
Contributor Author

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?

Copy link
Contributor

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:

Suggested change
bg: get('colors.label.primary.border'),
bg: 'label.primary.border',

Copy link
Contributor Author

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!

@VanAnderson VanAnderson marked this pull request as ready for review March 1, 2021 15:54
@@ -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 {
Copy link
Contributor Author

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?

Copy link
Contributor

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

Copy link
Contributor

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.

@VanAnderson VanAnderson force-pushed the VanAnderson/implement-functional-color-vars-2 branch from 295075c to 4b794b3 Compare March 1, 2021 16:19
@vercel vercel bot temporarily deployed to Preview March 1, 2021 16:19 Inactive
@VanAnderson VanAnderson force-pushed the VanAnderson/implement-functional-color-vars-2 branch from 4b794b3 to 29de1a0 Compare March 1, 2021 18:25
@vercel vercel bot temporarily deployed to Preview March 1, 2021 18:25 Inactive
@VanAnderson VanAnderson force-pushed the VanAnderson/implement-functional-color-vars-2 branch from 29de1a0 to a9fdcbb Compare March 1, 2021 18:56
@vercel vercel bot temporarily deployed to Preview March 1, 2021 18:56 Inactive
@VanAnderson VanAnderson force-pushed the VanAnderson/implement-functional-color-vars-2 branch from a9fdcbb to 2aa25b7 Compare March 1, 2021 18:57
@vercel vercel bot temporarily deployed to Preview March 1, 2021 19:00 Inactive
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')};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'),
Copy link
Contributor

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:

Suggested change
bg: get('colors.label.primary.border'),
bg: 'label.primary.border',

@VanAnderson VanAnderson force-pushed the VanAnderson/implement-functional-color-vars-2 branch from 2aa25b7 to 56e28a2 Compare March 2, 2021 16:28
@vercel vercel bot temporarily deployed to Preview March 2, 2021 16:28 Inactive
@VanAnderson VanAnderson force-pushed the VanAnderson/implement-functional-color-vars-2 branch from 56e28a2 to 9aed7e1 Compare March 2, 2021 17:24
@vercel vercel bot temporarily deployed to Preview March 2, 2021 17:24 Inactive
@VanAnderson VanAnderson changed the title Implement functional color variables [Label, ButtonTableList, ButtonInvisible, Button, Breadcrumb] Implement functional color variables part 2 [Label, ButtonTableList, ButtonInvisible, Button, Breadcrumb] Mar 2, 2021
Copy link

@bscofield bscofield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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')};
Copy link
Contributor Author

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 🤷‍♂️

@vercel vercel bot temporarily deployed to Preview March 3, 2021 17:21 Inactive
@VanAnderson VanAnderson force-pushed the VanAnderson/implement-functional-color-vars-2 branch from f697979 to 9aed7e1 Compare March 3, 2021 17:23
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')};
Copy link
Contributor Author

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

@vercel vercel bot temporarily deployed to Preview March 3, 2021 17:39 Inactive
src/Button/Button.tsx Outdated Show resolved Hide resolved
src/Button/Button.tsx Outdated Show resolved Hide resolved
@@ -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')};
Copy link
Contributor

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>
@vercel vercel bot temporarily deployed to Preview March 4, 2021 15:39 Inactive
@VanAnderson VanAnderson force-pushed the VanAnderson/implement-functional-color-vars-2 branch from a0096aa to 05ec28d Compare March 4, 2021 15:42
@vercel vercel bot temporarily deployed to Preview March 4, 2021 15:43 Inactive
@vercel vercel bot temporarily deployed to Preview March 4, 2021 16:33 Inactive
@vercel vercel bot temporarily deployed to Preview March 4, 2021 16:42 Inactive
Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@colebemis colebemis merged commit 7fd57c8 into main Mar 4, 2021
@colebemis colebemis deleted the VanAnderson/implement-functional-color-vars-2 branch March 4, 2021 16:46
@github-actions github-actions bot mentioned this pull request Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants