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

New Icon Mixin #1262

Merged
merged 14 commits into from
Dec 5, 2024
Merged

New Icon Mixin #1262

merged 14 commits into from
Dec 5, 2024

Conversation

GGKapanadze
Copy link
Member

@GGKapanadze GGKapanadze commented Dec 5, 2024

Description

This PR introduces a new mixin that supports base64 icon placement with new theme support (#999)

API

The API for the new mixin is almost the same, to maintain the same DX

@include icon("chevron_right", var(--ilo-color-blue));
  1. The icon machine name from @ilo-org/icon, required
  2. The CSS variable that indicates the color of the icon

Implementation

Base64 encoded svg has no direct support for CSS variables since it is evaluated as a static string, one possible solution to get rid of dataurilicon was to eliminate the base64 encoded svgs but it has its disadvantages

  • We are maintaining two design systems for react and for twig and having a single source of truth from the styles package is a good thing
  • We could use the icon component for both twig and react, but for twig users js bundle for the icon component will become the required dependency, which isn't common behavior for the drupal & symphony projects
  • Right now twig and react have radically different coverage for the components in terms of js so maintaining icons from the styles package will increase the phase for the development
  • The rewrite overhead (time-wise)

So, the current implementation keeps the icons in base64 and adds CSS variables support with the utilization of the mask-image. You can read more about mask-image here;tldr, we place the icon as a mask element and add color to it using background-color.

There is a disadvantage too, if one node uses both icon mixin and background color they should be split markup-wise or pseudo selectors should be used

Component migration

First I tried to port all the components, but it would block further development of the components, so we can address every component in the scope of #971. The PR has a few examples of how to port the component to the new mixin.

Migrated components

Component Status
Accordion 💬 icon is styled as a separate tag
Blockquote
Callout
Linklist 💬 reduced file size, +improved rtl, missing ident icon
Pagination ✅ on of the biggest user of dataurlicon
Tag

@GGKapanadze GGKapanadze self-assigned this Dec 5, 2024
Copy link

changeset-bot bot commented Dec 5, 2024

🦋 Changeset detected

Latest commit: 3008904

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

@GGKapanadze GGKapanadze linked an issue Dec 5, 2024 that may be closed by this pull request
Copy link

netlify bot commented Dec 5, 2024

Deploy Preview for ilo-ui-react ready!

Name Link
🔨 Latest commit 3008904
🔍 Latest deploy log https://app.netlify.com/sites/ilo-ui-react/deploys/6751b06d569aff0008f39cd3
😎 Deploy Preview https://deploy-preview-1262--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 Dec 5, 2024

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

Name Link
🔨 Latest commit 3008904
🔍 Latest deploy log https://app.netlify.com/sites/ilo-ui-twig-develop/deploys/6751b06d4b819c0008222664
😎 Deploy Preview https://deploy-preview-1262--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.

Copy link

netlify bot commented Dec 5, 2024

Deploy Preview for ilo-ui-twig ready!

Name Link
🔨 Latest commit 3008904
🔍 Latest deploy log https://app.netlify.com/sites/ilo-ui-twig/deploys/6751b06d7314470008c56275
😎 Deploy Preview https://deploy-preview-1262--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.

@GGKapanadze GGKapanadze force-pushed the feat/icons-with-variables branch from 356e109 to 3008904 Compare December 5, 2024 13:53
@justintemps justintemps merged commit 633a082 into develop Dec 5, 2024
12 of 13 checks passed
@justintemps justintemps deleted the feat/icons-with-variables branch December 5, 2024 15:49
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.

CSS variables support to dataurlicon
2 participants