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(themes): correctly set carbon--theme when nesting themes #5760

Conversation

joshblack
Copy link
Contributor

Noticed this with the work @janhassel is doing over in: #5382

It seems like we're not correctly setting $carbon--theme when nested inside of the carbon--theme mixin. This meant that the following was working incorrectly:

$carbon--theme: ( value-01: #ffffff );
$carbon--theme--dark: (value-01: #000000 );

@include carbon--theme($carbon--theme--dark) {
  @debug map-get($carbon--theme, 'value-01'); // Incorrectly logs #ffffff
}

This PR updates the builder for our theme mixin to correctly handle this case by setting the current $carbon--theme value at the beginning of the function to a local $parent-carbon-theme variable and is then reset to that value at the end of the function.

Changelog

New

Changed

  • Update theme builder to correctly set $carbon--theme when nested in the carbon--theme mixin

Removed

@joshblack joshblack requested a review from a team as a code owner March 31, 2020 16:46
@ghost ghost requested review from dakahn and emyarod March 31, 2020 16:46
@netlify
Copy link

netlify bot commented Mar 31, 2020

Deploy preview for carbon-elements ready!

Built with commit e001fae

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

@netlify
Copy link

netlify bot commented Mar 31, 2020

Deploy preview for carbon-components-react ready!

Built with commit e001fae

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

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me

@joshblack
Copy link
Contributor Author

@dakahn let me know if you want to go over these changes!

@joshblack joshblack merged commit 68e304a into carbon-design-system:master Apr 2, 2020
@joshblack joshblack deleted the fix/update-carbon-theme-when-nested branch April 2, 2020 14:51
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.

3 participants