gilbarbara/react-inlinesvg

add support for ratio

Evanion opened this issue · 1 comments

This is a great component, solve my issue beautifully!

I'm using it to laod icons form the uikit library, and they use the ratio attribute on their svgs to size the icon.

default:

<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" ratio="1">
  <polyline fill="none" stroke="#000" stroke-width="1.1" points="4,10 8,15 17,4"></polyline>
</svg>

ratio 2:

<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 20 20" ratio="2">
  <polyline fill="none" stroke="#000" stroke-width="1.1" points="4,10 8,15 17,4"></polyline>
</svg>

As you can se the ratio also multiplies the width and height attributes with the ratio.
Would it be possible to add this to your API?

Not really since ratio isn't part of the SVG specification.

[s]