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

[Icons] Fix aliases support when fetching multiples icons with Iconify #2467

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Dec 25, 2024

Q A
Bug fix? yes
New feature? no
Issues Fix #...
License MIT

Use case:

  1. I need to download three icons
  2. I go to https://ux.symfony.com/icons, and select "Material Design Icons"
  3. I search for capsule, sign and glasses
  4. https://ux.symfony.com/icons suggests me to run symfony console ux:icon:import mdi:capsule, symfony console ux:icon:import mdi:sign and symfony console ux:icon:import mdi:glasses (can be shortened to symfony console ux:icon:import mdi:capsule mdi:sign mdi:glasses)
  5. But it fails, it tells me icons mdi:capsule and mdi:sign do not exist

In fact, they exist, but those icons are alias pointing to another icon, see https://api.iconify.design/mdi.json?icons=capsule%2Cglasses%2Csign:

{
  "prefix": "mdi",
  "lastModified": 1718880438,
  "aliases": {
    "capsule": {
      "parent": "pill"
    },
    "sign": {
      "parent": "draw"
    }
  },
  "width": 24,
  "height": 24,
  "icons": {
    "pill": {
      "body": "<path fill=\"currentColor\" d=\"m4.22 11.29l7.07-7.07a6.01 6.01 0 0 1 8.49 0c2.34 2.34 2.34 6.14 0 8.49l-7.07 7.07c-2.35 2.34-6.15 2.34-8.49 0a6.01 6.01 0 0 1 0-8.49m1.42 1.42a3.98 3.98 0 0 0-1.04 3.86l5.99-5.98l4.24 4.24l3.53-3.54a3.98 3.98 0 0 0 0-5.65a3.98 3.98 0 0 0-5.65 0z\"/>"
    },
    "glasses": {
      "body": "<path fill=\"currentColor\" d=\"M3 10c-.24 0-.45.09-.59.25c-.14.15-.2.37-.17.61l.5 2.99C2.82 14.5 3.4 15 4 15h3c.64 0 1.36-.56 1.5-1.18l1.06-3.19c.04-.13.01-.32-.06-.44c-.11-.12-.28-.19-.5-.19zm4 7H4C2.38 17 .96 15.74.76 14.14l-.5-2.99C.15 10.3.39 9.5.91 8.92S2.19 8 3 8h6c.83 0 1.58.35 2.06.96c.11.15.21.31.29.49c.43-.09.87-.09 1.29 0c.08-.18.18-.34.3-.49C13.41 8.35 14.16 8 15 8h6c.81 0 1.57.34 2.09.92c.51.58.75 1.38.65 2.19l-.51 3.07C23.04 15.74 21.61 17 20 17h-3c-1.56 0-3.08-1.19-3.46-2.7l-.9-2.71c-.38-.28-.91-.28-1.29 0l-.92 2.78C10.07 15.82 8.56 17 7 17m8-7c-.22 0-.39.07-.5.19c-.08.12-.1.31-.05.51l1.01 3.05c.18.69.9 1.25 1.54 1.25h3c.59 0 1.18-.5 1.25-1.11l.51-3.07c.03-.2-.03-.42-.17-.57A.77.77 0 0 0 21 10z\"/>"
    },
    "draw": {
      "body": "<path fill=\"currentColor\" d=\"M9.75 20.85c1.78-.7 1.39-2.63.49-3.85c-.89-1.25-2.12-2.11-3.36-2.94A9.8 9.8 0 0 1 4.54 12c-.28-.33-.85-.94-.27-1.06c.59-.12 1.61.46 2.13.68c.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21c-.32.99.19 1.99.77 2.77c1.37 1.83 3.5 2.71 5.09 4.29c.34.33.75.72.95 1.18c.21.44.16.47-.31.47c-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.56.56 0 0 0-.78 0l-1.02 1.02l2.08 2.08M11 10.92V13h2.08l6.15-6.15l-2.08-2.08z\"/>"
    }
  }
}

But now, imagine I have ~120 icons to import but only ~80 of them have been imported... 😅

This PR add support for using aliases when fetching multiple icons (it already exist, but when fetching one icon).

@carsonbot carsonbot added Feature New Feature Icons Status: Needs Review Needs to be reviewed labels Dec 25, 2024
@Kocal Kocal requested review from kbond, smnandre and WebMamba December 25, 2024 23:50
@Kocal Kocal force-pushed the feat/ux-icons-iconify-aliases branch 2 times, most recently from 8ee5230 to 385566e Compare December 26, 2024 00:03
src/Icons/CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@smnandre smnandre left a comment

Choose a reason for hiding this comment

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

Thanks for this fix @Kocal!

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Dec 26, 2024
@Kocal
Copy link
Member Author

Kocal commented Dec 26, 2024

No one was sleeping or what? 😆

@Kocal Kocal force-pushed the feat/ux-icons-iconify-aliases branch from 385566e to f049743 Compare December 26, 2024 07:58
@Kocal Kocal changed the title [Icons] Add aliases when fetching multiples icons with Iconify [Icons] Fix aliases support when fetching multiples icons with Iconify Dec 26, 2024
@Kocal
Copy link
Member Author

Kocal commented Dec 26, 2024

Updated!

@Kocal Kocal added Bug Bug Fix and removed Feature New Feature labels Dec 26, 2024
@smnandre
Copy link
Member

Thanks a lot Kocal!

@smnandre smnandre merged commit 507c89c into symfony:2.x Dec 26, 2024
59 checks passed
@Kocal Kocal deleted the feat/ux-icons-iconify-aliases branch December 27, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix Icons Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants