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

Split sprites in individual svg files #4967

Open
hbruch opened this issue Mar 8, 2024 · 4 comments
Open

Split sprites in individual svg files #4967

hbruch opened this issue Mar 8, 2024 · 4 comments

Comments

@hbruch
Copy link
Contributor

hbruch commented Mar 8, 2024

Currently, svg icons are provides as a theme dependent sprites (default and hsl in this repo, addtional ones in downstream repositories). They are hard to maintain and contain much duplication.

For the embark-okc fork, we split them into indiviual svg files, and recreate the sprites in the static build step.

I suggest to do this upstream as well, as these individual svgs are easier to update, easier to override by inheriting themes, and could make of use includes to reduce duplication.

Should I provide a PR for this or do you have other plan?

Another question is what the long term strategy for icons is. digitransit-component-icon also duplicates many icons, but it is not evident, when to use this in contrast to the sprites approach, and how to support different themes.

@hbruch
Copy link
Contributor Author

hbruch commented Mar 14, 2024

@vesameskanen any thoughts on this?

@vesameskanen
Copy link
Member

We don't have any plans yet. I feel that we should have some sort of brainstorming session to figure out what to do.

@vesameskanen
Copy link
Member

vesameskanen commented Mar 18, 2024

I had a quick look. Current problems:

  • Sprite sheets are so large that they are hard to manage
  • Names are cryptic and unfriedly, no conventions to help
  • Some svg 's are messy, apparently straight from some drawing software
  • We use two parallel icon solutions, one sheet based and another from digitransit components
  • Styling is somewhat complicated - e.g. it is hard to see which colors come from css and which from props.

Anyway, the interface which digitransit-component-icon library exposes is simple:
<Icon img="arrow" width=2 heigth=2 color="#888888" />

It might make sense to move all icons directly to component-icon library, and expand its api to include all features that app/component/Icon.js has.

Any thoughts?

@hbruch
Copy link
Contributor Author

hbruch commented Mar 21, 2024

I'v got some reservations moving the icons to the digitransit-component-icon library. IMHO the developer experience with these components is not the best and I wonder how an extension mechanism for external instances would look like. Would HSL accept and integrate third-party icons in this component?

Treating icons as components is presumably the mid-term /long-term goal to achieve. The idea has been around for a while but apparently seemed to overwhelming until now.

The proposed splitting and reassembly during build could be an easy first step as it allows to address you bullet points 1-3.

Another advantage would be that this way, icons could be moved step by step to the digitransit-componen-icon library. Especially rebuilding the map-icon handling could be postponed until perhaps a switch to another map library would make it unneeded anyway.

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

No branches or pull requests

2 participants