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

Colors are missing when importing charts/styles/styles.scss #866

Closed
1 of 5 tasks
kgibb opened this issue Nov 6, 2020 · 6 comments · Fixed by #880
Closed
1 of 5 tasks

Colors are missing when importing charts/styles/styles.scss #866

kgibb opened this issue Nov 6, 2020 · 6 comments · Fixed by #880
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@kgibb
Copy link

kgibb commented Nov 6, 2020

  • Feature request
  • Design defect
  • Source code defect
  • Demo/documentation defect
  • Other

charts version:

0.40.11 Vanilla

Issue description

Colors are missing when importing charts/styles/styles.scss SCSS file directly.

Using [email protected].

Screenshot or recording

image

$color-map: map-merge(
$color-map,
(
"#{$name}-#{$category}": $value
)
);

The above block should use the !global flag to update the global scope $color-map.

$color-map: map-merge(
    $color-map,
    (
        "#{$name}-#{$category}": $value
    )
) !global;

Example: https://codesandbox.io/s/carbon-chart-missing-colors-2jgh2

@theiliad theiliad added the type: bug 🐛 Something isn't working label Nov 6, 2020
@sophiiae
Copy link
Contributor

sophiiae commented Nov 6, 2020

@kgibb can you provide more details about how to produce this issue? Thank you.

@kgibb
Copy link
Author

kgibb commented Nov 6, 2020

I've just forked a codepen sample. Updated description with the link.

@kgibb
Copy link
Author

kgibb commented Nov 6, 2020

I am aware it's working when pulling in the built out CSS. I am using node-sass as the description notes.

Fixing the $color-map variable shadowing will resolve the issue, see description.

@theiliad
Copy link
Member

theiliad commented Nov 9, 2020

I've just downloaded the sandbox and got it working. Seems like your imports are the issue here

Here's what worked for me:

@import "~@carbon/themes/scss/themes";
$carbon--theme: $carbon--theme--g10;

@import "~@carbon/charts/styles/styles.scss";
  1. You're using @carbon/themes off of the carbon charts vendor libraries, not recommended although it wouldn't break the code.
  2. Without the ~ the compiler doesn't seem to be able to resolve the libraries (not sure why codesandbox doesn't report this but downloading the sandbox and running locally will).

Fixing those I get this:
image

@theiliad theiliad closed this as completed Nov 9, 2020
@kgibb
Copy link
Author

kgibb commented Nov 10, 2020

The chart styles are resolved in the remote sandbox without the tilde, it's just the "./colors.scss" import is essentially empty due to the aforementioned scope issue.

image

I've created a Storybook sample using node-sass: https://ibm.box.com/s/4sm5t0oiboktmr64u8ns4guq7vfn0wh8

@theiliad
Copy link
Member

Storybook is a bit weird. When importing the colors module manually everything works... Eitherway, I've added the global flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment