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

chore(lumx-icons): override twitter icon #1028

Merged
merged 3 commits into from
Nov 23, 2023
Merged

Conversation

gcornut
Copy link
Member

@gcornut gcornut commented Nov 16, 2023

General summary

  1. Creating a script to override and alias icons in both TS and SCSS/Font
    • override/override-icons: contains SVG icons to override MDI
    • override/alias-icons.js: config contains mapping from icon name to aliases
    • override/generate.js: script that generate the TS & Font/SCSS overrides and then TS & Font/SCSS aliases

We'll use aliases to keep retro-compatibility when changing version or for brand renaming (ex: twitter). Overrides will help us update or restore brand logo because MDI is deprecating them.

  1. Override Twitter logo with X logo (and add name alias)

Testing

  1. Publishing an alpha prerelease alpha-icon-override-twitter https://github.com/lumapps/design-system/actions/runs/6956038315/job/18962918745
  2. Test in another project using both JS & font icons
    1. JS const mdiTwitter should still work but should have been swapped to the new X logo
    2. JS const mdiXTwitter should be the same as mdiTwitter
    3. css class .mdi-twitter should still work but should have been swapped to the new X logo
    4. css class .mdi-x-twitter should be the same as .mdi-twitter

@gcornut gcornut force-pushed the feat/icon-override-twitter branch 3 times, most recently from 3cf4837 to 28bcf88 Compare November 22, 2023 10:09
@gcornut gcornut force-pushed the feat/icon-override-twitter branch 2 times, most recently from 6675dc1 to d247232 Compare November 22, 2023 10:28
@gcornut gcornut marked this pull request as ready for review November 22, 2023 11:43
@gcornut gcornut requested review from lumautomation, matmkian and a team as code owners November 22, 2023 11:43
@gcornut gcornut force-pushed the feat/icon-override-twitter branch 2 times, most recently from 856b243 to 0231619 Compare November 22, 2023 12:00
packages/lumx-icons/override/generate.js Outdated Show resolved Hide resolved
packages/lumx-icons/override/generate.js Outdated Show resolved Hide resolved


// Bundle TS types in D.TS files
const bundleType = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a specific reason why we need types on the released version for our icons?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes the mdi icon types are really trivial but when you import non-typed module in TS project it can produce errors or warnings (depending on the project config). We did had types before from mdi (and from the v4-to-v5 alias file), I just replaced manual type definition with automatic .d.ts bundling (we already use on @lumx/react)

@gcornut gcornut force-pushed the feat/icon-override-twitter branch 2 times, most recently from 4a3c08d to 18a1cac Compare November 23, 2023 10:31
@gcornut gcornut force-pushed the feat/icon-override-twitter branch from 18a1cac to de8eacb Compare November 23, 2023 10:35
@gcornut gcornut requested a review from juanigalan91 November 23, 2023 10:43
@gcornut
Copy link
Member Author

gcornut commented Nov 23, 2023

Re-running an prerelease to re-test everything...

@gcornut
Copy link
Member Author

gcornut commented Nov 23, 2023

Tested in another project using both JS & font icons

  • JS const mdiTwitter should still work but should have been swapped to the new X logo ✅
  • JS const mdiXTwitter should be the same as mdiTwitter ✅
  • css class .mdi-twitter should still work but should have been swapped to the new X logo ✅
  • css class .mdi-x-twitter should be the same as .mdi-twitter ✅

@gcornut gcornut merged commit 9ea8a3b into master Nov 23, 2023
@gcornut gcornut deleted the feat/icon-override-twitter branch November 23, 2023 15:12
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.

2 participants