tool-bar icon indicating copy to clipboard operation
tool-bar copied to clipboard

Dynamic mdi icons

Open aminya opened this issue 4 years ago • 6 comments

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

image

image

aminya avatar Jul 18 '20 13:07 aminya

@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.

aminya avatar Jul 18 '20 13:07 aminya

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.

ericcornelissen avatar Jul 25 '20 12:07 ericcornelissen

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?

aminya avatar Jul 25 '20 15:07 aminya

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.

ericcornelissen avatar Jul 25 '20 15:07 ericcornelissen

@ericcornelissen This now works.

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

aminya avatar Jul 26 '20 10:07 aminya

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: https://github.com/iconify/iconify/issues/31 This is an example of how it works: https://github.com/iconify/iconify/issues/30

aminya avatar Jul 26 '20 13:07 aminya