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(react-twig): refactor light social media icon color #1179

Closed
wants to merge 3 commits into from

Conversation

Shashika6
Copy link
Contributor

@Shashika6 Shashika6 commented Aug 25, 2024

Fixes #1012

Notes

  • Refactor social media icon color in light theme

Copy link

changeset-bot bot commented Aug 25, 2024

🦋 Changeset detected

Latest commit: 7f243ab

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

This PR includes changesets to release 3 packages
Name Type
@ilo-org/styles Patch
@ilo-org/react Patch
@ilo-org/twig 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

@Shashika6 Shashika6 marked this pull request as ready for review August 25, 2024 12:48
Copy link

netlify bot commented Aug 25, 2024

Deploy Preview for ilo-ui-react ready!

Name Link
🔨 Latest commit 7f243ab
🔍 Latest deploy log https://app.netlify.com/sites/ilo-ui-react/deploys/66d8155c8ce86d000730ec41
😎 Deploy Preview https://deploy-preview-1179--ilo-ui-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Aug 25, 2024

Deploy Preview for ilo-ui-twig ready!

Name Link
🔨 Latest commit 7f243ab
🔍 Latest deploy log https://app.netlify.com/sites/ilo-ui-twig/deploys/66d8155cd5a94100081be4f5
😎 Deploy Preview https://deploy-preview-1179--ilo-ui-twig.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Aug 25, 2024

Deploy Preview for ilo-ui-twig-develop ready!

Name Link
🔨 Latest commit 7f243ab
🔍 Latest deploy log https://app.netlify.com/sites/ilo-ui-twig-develop/deploys/66d8155cd7dc810008bd5415
😎 Deploy Preview https://deploy-preview-1179--ilo-ui-twig-develop.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

$icon,
map-get($color, "socialmedia", $theme, "icon", "color")
);
@include dataurlicon($icon, rgba(30, 45, 190, 1));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey team since we are moving away from map-get and using css variables, there a small problem in this one. Css variables cant be used in mixins.

For the time being I used rgba(30, 45, 190, 1) as it doesn't support hex values as well.

How should we go with this one @justintemps @bashlk @GGKapanadze

@Shashika6
Copy link
Contributor Author

@justintemps I tried passing the variable as a string but it doesn't seem to work. So for the time being I created a scss variable.

@Shashika6 Shashika6 force-pushed the fix/react-twig/social-media branch from 216ab88 to 9ba916e Compare August 29, 2024 12:35
@@ -7,9 +7,10 @@
$c: &;
$default-theme: "light";
$icon-size: $spacing-spacing-4;
$ilo-color-blue: "rgba(30, 45, 190, 1)";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think what the guys meant is to assign the CSS variable to the SCSS variable so that it can be passed into the mixin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean $ilo-color-blue: var(--ilo-color-blue); right ? I tried this but it didnt seem to work.

@justintemps
Copy link
Member

@Shashika6 also I think you forgot to implement the dark theme version

@justintemps
Copy link
Member

@bashlk, @Shashika6 and @GGKapanadze, the problem here isn't that css vars can't be used in mixins, the problem is that they don't work inside a data url, which is what the icon function and mixins are doing. They give us something like this:

background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 21'%3e%3cpath fill='var(--ilo-color-blue)' d='M18.901 0.153564H22.581L14.541 9.34356L24 21.8466H16.594L10.794 14.2626L4.156 21.8466H0.474L9.074 12.0166L0 0.154564H7.594L12.837 7.08657L18.901 0.153564ZM17.61 19.6446H19.649L6.486 2.24056H4.298L17.61 19.6446Z'/%3e%3c/svg%3e");

If you see, the variable is getting passed appropriately, but because the SVG isn't in the DOM per se, it doesn't work.

I think this reveals a small but important flaw in our new approach for handling tokens, in that css variables can't be used in some contexts. I'm not sure what the best way to handle this is.

@GGKapanadze
Copy link
Member

Yep, variables can't be directly used with fill, but if we still want to do background images for icons I can reimplement this mixin with 'mask-image'

@Shashika6
Copy link
Contributor Author

Marking this as a draft till #1189 is completed.

@Shashika6 Shashika6 marked this pull request as draft September 4, 2024 08:09
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.

Social media icons: review colours
4 participants