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

Dynamic mdi icons #310

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

Dynamic mdi icons #310

wants to merge 11 commits into from

Conversation

aminya
Copy link
Member

@aminya aminya commented Jul 18, 2020

This defers the loading of mdi icons until they are called. It improves the loading time (50ms->35ms).

image

image

@aminya
Copy link
Member Author

aminya commented Jul 18, 2020

@ericcornelissen @suda I cannot seem to be able to propagate button style (size, colors, etc) to the icon (svg). I would appreciate any help here.

There is also @mdi/svg: https://github.com/Templarian/MaterialDesign-SVG, which every icon is a separate svg file. That could be another alternative.

@ericcornelissen
Copy link
Contributor

I cannot seem to be able to propagate button style (size, colors, etc) to the icon (svg). I would appreciate any help here.

Could you provide a working example outside of Atom (in Codepen or a similar service) that doesn't style the SVG the way you expect it to, that would make it a little easier to understand what isn't working and how experimenting with how it can be resolved.

What I can say based just on your comment: Note that for the color you probably need to use the CSS attribute fill instead of color to add color the SVG and for the size you need to take into account the viewBox of the SVG.

@aminya
Copy link
Member Author

aminya commented Jul 25, 2020

What I can say based just on your comment: Note that for the color you probably need to use the CSS attribute fill instead of color to add color the SVG and for the size you need to take into account the viewBox of the SVG.

Yes, I should do that instead. I thought SVG is like other HTML elements. Isn't there a way to wrap SVG in an HTML element that allows CSS formatting?

@ericcornelissen
Copy link
Contributor

Yes, I should do that instead. I thought SVG is like other HTML elements. Isn't there a way to wrap SVG in an HTML element that allows CSS formatting?

As far as I know, the way you would want it to work is only possible with icon fonts.

@aminya
Copy link
Member Author

aminya commented Jul 26, 2020

@ericcornelissen This now works.

Now we only need to fix the tests! I cannot query the svg element anyhow. 😞

@aminya
Copy link
Member Author

aminya commented Jul 26, 2020

Besides this PR, I saw another very cool framework which is called iconify. I am trying to learn how it works. Using that we can expand the number of supported icons and also improve the speed.

This is me trying to make it work offline: iconify/iconify#31
This is an example of how it works: iconify/iconify#30

@aminya aminya closed this Jul 22, 2021
@aminya aminya closed this Jul 22, 2021
@aminya aminya reopened this Jul 22, 2021
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