Skip to content

Commit

Permalink
make title prop optional
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Mar 26, 2024
1 parent 979bb25 commit 38510d6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/lib/src/icon_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ pub struct IconProps<T: IconShape + Clone + PartialEq + 'static> {
#[props(default = "".to_string())]
pub class: String,
/// An accessible, short-text description for the icon.
#[props(default = "".to_string())]
pub title: String,
pub title: Option<String>,
}

/// Icon component which generates SVG elements
Expand All @@ -42,9 +41,11 @@ pub fn Icon<T: IconShape + Clone + PartialEq + 'static>(props: IconProps<T>) ->
xmlns: "{props.icon.xmlns()}",
fill: "{props.fill}",
stroke: "{props.fill}",
title {
"{props.title}"
}
if let Some(title_text) = props.title {
title {
"{title_text}"
}
},
{props.icon.child_elements()}
}
)
Expand Down

0 comments on commit 38510d6

Please sign in to comment.