Skip to content

Commit 67f0d36

Browse files
committed
omit icon size by default
1 parent 3176e51 commit 67f0d36

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/lib/src/icon_component.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ pub trait IconShape {
2121
pub struct IconProps<T: IconShape + Clone + PartialEq + 'static> {
2222
/// The icon shape to use.
2323
pub icon: T,
24-
/// The height of the `<svg>` element. Defaults to 20.
25-
#[props(default = 20)]
26-
pub height: u32,
27-
/// The width of the `<svg>` element. Defaults to 20.
28-
#[props(default = 20)]
29-
pub width: u32,
24+
/// The height of the `<svg>` element. Omitted by default.
25+
pub height: Option<u32>,
26+
/// The width of the `<svg>` element. Omitted by default.
27+
pub width: Option<u32>,
3028
/// The color to use for filling the icon. Defaults to "currentColor".
3129
#[props(default = "currentColor".to_string())]
3230
pub fill: String,
@@ -47,8 +45,8 @@ pub fn Icon<T: IconShape + Clone + PartialEq + 'static>(props: IconProps<T>) ->
4745
svg {
4846
class: "{props.class}",
4947
style: props.style,
50-
height: "{props.height}",
51-
width: "{props.width}",
48+
height: props.height.map(|height| height.to_string()),
49+
width: props.width.map(|width| width.to_string()),
5250
view_box: "{props.icon.view_box()}",
5351
xmlns: "{props.icon.xmlns()}",
5452
fill,

0 commit comments

Comments
 (0)