Skip to content

Commit

Permalink
Types - Added Better Typings for Width, Height + Size (#219)
Browse files Browse the repository at this point in the history
* added string to union type for height, width and size

* added changeset

* Updated docs with new props
  • Loading branch information
Harry-Ross authored Aug 16, 2024
1 parent a4ff873 commit f18661f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-poems-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro-icon": patch
---

Added better typings for height, width and size to accept non-number values (i.e. 2 rem)
6 changes: 3 additions & 3 deletions packages/core/components/Icon.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ interface Props extends HTMLAttributes<"svg"> {
name: Icon;
"is:inline"?: boolean;
title?: string;
size?: number;
width?: number;
height?: number;
size?: number | string;
width?: number | string;
height?: number | string;
}
class AstroIconError extends Error {
Expand Down
6 changes: 3 additions & 3 deletions packages/www/src/content/docs/guides/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ interface Props extends HTMLAttributes<"svg"> {
/** Shorthand for including a <title>{props.title}</title> element in the SVG */
title?: string;
/** Shorthand for setting width and height */
size?: number;
width?: number;
height?: number;
size?: number | string;
width?: number | string;
height?: number | string;
}
```

Expand Down

0 comments on commit f18661f

Please sign in to comment.