Decathlon / vitamin-design

Decathlon Design System - Design workflow management
https://decathlon.design
Apache License 2.0
34 stars 6 forks source link

Icons & assets cannot be used with the <use> SVG element on the web #135

Closed thibault-mahe closed 1 year ago

thibault-mahe commented 1 year ago

Duplicates ❌

Which Figma library is concerned?

Vitamin Assets

Current behavior 😯

Some flags are not displayed in the web browser when used with the <use> SVG element (a strategy recommended in our project's README)

<svg width="32" height="32" fill="#001018">
  <use
    xlink:href="/node_modules/@vtmn/icons/dist/vitamix/sprite/vitamix.svg#home-fill"
  />
</svg>

Expected behavior πŸ€”

Either the flag should be displayed normally in the browser (ideal) or this icon strategy should not be recommended in the README.

This latter solution should be discussed as consuming the icons with the <use> element has many benefits.

Context πŸ”¦

See the open issue on the vitamin-web repo: https://github.com/Decathlon/vitamin-web/issues/1313

TL;DR:

I tried to clean as much as I can all the flags but many icons remains dependent of these features. Here is the remaining issued flags I listed:

cash, cb, cheque-payment, decathlon-logo-with-outline, discover, dwolla, flag-ad, flag-ag, flag-ai, flag-ao, flag-as, flag-aw, flag-az, flag-ba, flag-bj, flag-bl, flag-bm, flag-bs, flag-bv, flag-bz, flag-cc, flag-cg, flag-ck, flag-co, flag-coc, flag-cv, flag-cw, flag-cx, flag-de, flag-fk, flag-fo, flag-gb-eng, flag-gb-nir, flag-gb-sct, flag-gb-wls, flag-gb-zet, flag-gd, flag-gf, flag-gi, flag-gl, flag-gp, flag-gs, flag-gu, flag-hm, flag-hr, flag-ht, flag-il, flag-io, flag-jp, flag-ke, flag-ki, flag-kn, flag-kr, flag-ky, flag-lc, flag-lgbt, flag-ls, flag-ly, flag-ma, flag-mf, flag-mh, flag-mk, flag-mm, flag-mn, flag-mp, flag-mq, flag-ms, flag-mt, flag-na, flag-nc, flag-nf, flag-ni, flag-no, flag-nr, flag-nu, flag-pf, flag-pm, flag-pn, flag-pr, flag-ps, flag-py, flag-re, flag-rs, flag-rw, flag-sb, flag-sh, flag-si, flag-sj, flag-ss, flag-sv, flag-sx, flag-sz, flag-tk, flag-to, flag-tt, flag-tv, flag-tz, flag-um, flag-us-ca, flag-us, flag-uz, flag-va, flag-vi, flag-vu, flag-wf, flag-ws, flag-xk, flag-yt, flag-za, flag-zm, flag-zw, pay-u

Probably that a rewrite of all the SVG flags, without clip-path, mask or filter, should be considered.

The issue could be the same on the vitamix file.

Screenshots / Videos πŸ“Έ

No response

SimonLeclercq commented 1 year ago

It seems to be related to the construction of the assets, the different figma layers creating "path" or other defs in the svg. I'll see how much we can process the output files

SimonLeclercq commented 1 year ago

After digging, shapes used to design the flag contain style parameters hidden in Figma, but clearly visible on the .json

Image

Image


By removing them, the json is lightened and cleaner, but a clip-path still appears: it's the mask which allows to have corner-radius.

Image

By removing it, the json contains only the minimum of tags: the svg tag with the viewbox and the XMLNS & the different shapes, with the clip-rules and the fill.

Image

I think the solution lies in using a cleaner library (either clean this one or use one that is better composed?). I started to look if cleaner exports were possible with plugins, without much success.

thibault-mahe commented 1 year ago

Thanks @SimonLeclercq ! i just reviewed a PR on adding new icons on vitamix and some icons had the same issue, meaning that other non-flags icons could be also concerned

lauthieb commented 1 year ago

This problem is also there for some payments, logos & icons. So we need to be careful about all icons & assets.

GerardPaligot commented 1 year ago

Note: Think to update IM flag and JCB payment assets with this issue.

SimonLeclercq commented 1 year ago

IM-flag & JCB payment fixed @GerardPaligot

lauthieb commented 1 year ago

Fixed with https://github.com/Decathlon/vitamin-web/pull/1410 :tada: