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

fix(components): update get-token-value helper to error out at end of loop #5838

Merged
merged 8 commits into from
Apr 14, 2020

Conversation

joshblack
Copy link
Contributor

This fixes an issue consumers were having with 10.11.0 where get-token-value was error'ing out. It seems like the @error block was included in the @each block which causes it to throw if the theme was not the first match. This PR moves the @error call out of this loop such that if nothing is returned by the loop it throws. This also cleans up the error messages to be more detailed.

Changelog

New

Changed

  • Update _component-tokens.scss to account for matching on the theme across all iterations

Removed

Testing / Reviewing

  • Switch the default theme in our environment to something other than $carbon--theme--white and verify that it runs

@joshblack joshblack requested a review from a team as a code owner April 9, 2020 20:17
@ghost ghost requested review from asudoh and tw15egan April 9, 2020 20:17
@netlify
Copy link

netlify bot commented Apr 9, 2020

Deploy preview for carbon-elements ready!

Built with commit bb11595

https://deploy-preview-5838--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Apr 9, 2020

Deploy preview for carbon-components-react ready!

Built with commit bb11595

https://deploy-preview-5838--carbon-components-react.netlify.com

@joshblack
Copy link
Contributor Author

Quick question @laurenmrice, for tags what should we do if someone has written a custom theme? Would there be a good set of fallback colors we could use?

@netlify
Copy link

netlify bot commented Apr 9, 2020

Deploy preview for carbon-elements ready!

Built with commit fefc853

https://deploy-preview-5838--carbon-elements.netlify.com

Copy link
Collaborator

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

Working as expected 👍 ✅

@netlify
Copy link

netlify bot commented Apr 9, 2020

Deploy preview for carbon-components-react ready!

Built with commit fefc853

https://deploy-preview-5838--carbon-components-react.netlify.com

@joshblack joshblack mentioned this pull request Apr 10, 2020
30 tasks
Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

LGTM 👍 - Thanks @joshblack!

@aagonzales
Copy link
Member

@joshblack What can we do with tags for theming? I always just assumed they would have to override the colors. Creating tokens for each tag color seems excessive.

@joshblack
Copy link
Contributor Author

joshblack commented Apr 13, 2020

Chatted with @aagonzales real quick on Slack and she said that fallback colors should come from the white theme 👍

We might need to do two additional things for custom theme support:

  • Instead of doing a direct comparison for $carbon--theme == $carbon--theme--g100 we should try and see if $carbon--theme--g100 is a subset of $carbon--theme
  • Add a fallback instead of error'ing out if no value is found

@joshblack
Copy link
Contributor Author

Note to reviewers @asudoh @tw15egan @vpicone just added in some tests for the custom theme use-case and a new structure to handle the fallback situation shared above.

Let me know if you have any feedback or questions!

@joshblack joshblack merged commit d0d917f into master Apr 14, 2020
@joshblack joshblack deleted the joshblack-patch-2 branch April 14, 2020 16:53
joshblack added a commit to joshblack/carbon that referenced this pull request Apr 16, 2020
… loop (carbon-design-system#5838)

* Update _component-tokens.scss

* Update _component-tokens.scss

* fix(component-tokens): update helper and add test suite for custom themes

* fix(components): update emit-component-tokens and move from themes

Co-authored-by: TJ Egan <tw15egan@gmail.com>
joshblack added a commit that referenced this pull request Apr 21, 2020
… loop (#5838)

* Update _component-tokens.scss

* Update _component-tokens.scss

* fix(component-tokens): update helper and add test suite for custom themes

* fix(components): update emit-component-tokens and move from themes

Co-authored-by: TJ Egan <tw15egan@gmail.com>
This was referenced Apr 23, 2020
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.

5 participants