Skip to content

Commit

Permalink
fix ionicons
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Mar 26, 2024
1 parent deefc23 commit 979bb25
Show file tree
Hide file tree
Showing 11 changed files with 1,493 additions and 1,464 deletions.
7 changes: 6 additions & 1 deletion packages/codegen/src/create_icon_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn extract_svg_attrs(element: &Element) -> (String, String) {
.unwrap_or("http://www.w3.org/2000/svg");
(String::from(view_box), String::from(xmlns))
}

// "fill:none;stroke:#000;
fn extract_svg_child_elements(elements: &[&Element], icon_prefix: &str) -> String {
let elements = match icon_prefix {
"Md" => &elements[1..],
Expand All @@ -144,6 +144,11 @@ fn extract_svg_child_elements(elements: &[&Element], icon_prefix: &str) -> Strin
let mut element_attrs = element
.attrs()
.filter_map(|(name, value)| {
let value = if icon_prefix == "Io" {
value.replace("fill:none;stroke:#000;", "")
} else {
value.to_string()
};
let re = Regex::new(r"^data-.*$").unwrap();
if !re.is_match(name) && name != "fill" {
Some(format!(
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/icon_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ pub struct IconProps<T: IconShape + Clone + PartialEq + 'static> {
pub fn Icon<T: IconShape + Clone + PartialEq + 'static>(props: IconProps<T>) -> Element {
rsx!(
svg {
stroke: "currentColor",
stroke_width: "0",
class: "{props.class}",
height: "{props.height}",
width: "{props.width}",
view_box: "{props.icon.view_box()}",
xmlns: "{props.icon.xmlns()}",
fill: "{props.fill}",
stroke: "{props.fill}",
title {
"{props.title}"
}
Expand Down
2,900 changes: 1,450 additions & 1,450 deletions packages/lib/src/icons/io_icons.rs

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion packages/lib/src/icons/md_communication_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,9 @@ impl IconShape for MdUnsubscribe {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down
12 changes: 9 additions & 3 deletions packages/lib/src/icons/md_content_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ impl IconShape for MdBolt {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down Expand Up @@ -1191,7 +1193,9 @@ impl IconShape for MdTag {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down Expand Up @@ -1259,7 +1263,9 @@ impl IconShape for MdWaves {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down
8 changes: 6 additions & 2 deletions packages/lib/src/icons/md_hardware_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ impl IconShape for MdMonitor {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down Expand Up @@ -929,7 +931,9 @@ impl IconShape for MdTabletMac {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/icons/md_image_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2281,7 +2281,9 @@ impl IconShape for MdHdrOff {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/icons/md_notification_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ impl IconShape for MdAddCall {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down
8 changes: 6 additions & 2 deletions packages/lib/src/icons/md_places_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,9 @@ impl IconShape for MdMeetingRoom {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down Expand Up @@ -842,7 +844,9 @@ impl IconShape for MdNoMeetingRoom {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/icons/md_social_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,9 @@ impl IconShape for MdNotifications {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/lib/src/icons/md_toggle_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ impl IconShape for MdStarOutline {
String::from("http://www.w3.org/2000/svg")
}
fn child_elements(&self) -> Element {
rsx! {}
rsx! {

}
}
}

Expand Down

0 comments on commit 979bb25

Please sign in to comment.