natemoo-re / astro-icon

Inline and sprite-based SVGs in Astro made easy!
https://astroicon.dev
Other
990 stars 57 forks source link

Icon props: Accept `size?: string` to pass size units #213

Open am0wa opened 3 months ago

am0wa commented 3 months ago

What version of astro-icon are you using?

v1.1.0

Astro Info

Astro                    v4.4.11
Node                     v18.16.1
System                   macOS (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             astro-icon
                         @astrojs/starlight
                         @astrojs/tailwind

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Type error when passing size as string specifying units.

<>
  {icon && <Icon name={emojiName} size="1.999em" />}
</>
{/* error ts(2322): Type 'string' is not assignable to type 'number'. */}

What's the expected result?

Expected: make size?: string to be able to specify units aka rem, em, px, etc. similar to real SVG width/height attributes

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ekzvvi?file=astro.config.mjs,src%2Fpages%2Findex.astro