💄 Make the "logo" shape reusable

This commit is contained in:
2024-04-26 19:31:05 +02:00
parent 894f32e177
commit 7078f86cd8
2 changed files with 26 additions and 24 deletions

View File

@@ -10,12 +10,32 @@ include!(concat!(env!("OUT_DIR"), "/style_vars.rs"));
use style::{COLOR_PRIMARY_100, COLOR_TERNARY_100}; use style::{COLOR_PRIMARY_100, COLOR_TERNARY_100};
pub fn DownArrowIcon() -> Element { pub fn DownArrowIcon() -> Element {
#[derive(Clone, PartialEq)]
pub(crate) struct LogoShape;
impl IconShape for LogoShape {
fn view_box(&self) -> &str {
"0 0 184 94"
}
fn xmlns(&self) -> &str {
"http://www.w3.org/2000/svg"
}
fn child_elements(&self) -> Element {
rsx! {
path {
"stroke-linejoin": "round",
"stroke-width": "6",
d: "M121.208 2 2 57.011l70.927-.265L61.363 92 182 36.724h-69.498L121.208 2Z"
}
}
}
}
pub fn LogoIcon() -> Element {
rsx! { rsx! {
style { {STYLE_SHEET} }, style { {STYLE_SHEET} },
Icon { Icon {
class: ClassName::DOWN_ARROW_ICON, icon: LogoShape,
icon: MdArrowDropDown,
} }
} }
} }

View File

@@ -1,28 +1,10 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::{Icon, IconShape}; use dioxus_free_icons::Icon;
use crate::ui::components::icons::LogoShape;
turf::style_sheet!("src/ui/components/spinner.scss"); turf::style_sheet!("src/ui/components/spinner.scss");
#[derive(Clone, PartialEq)]
struct _Spinner;
impl IconShape for _Spinner {
fn view_box(&self) -> &str {
"0 0 184 94"
}
fn xmlns(&self) -> &str {
"http://www.w3.org/2000/svg"
}
fn child_elements(&self) -> Element {
rsx! {
path {
"stroke-linejoin": "round",
"stroke-width": "6",
d: "M121.208 2 2 57.011l70.927-.265L61.363 92 182 36.724h-69.498L121.208 2Z"
}
}
}
}
#[derive(PartialEq, Clone, Props)] #[derive(PartialEq, Clone, Props)]
pub struct SpinnerProps { pub struct SpinnerProps {
#[props(default = true)] #[props(default = true)]
@@ -38,7 +20,7 @@ pub fn Spinner(props: SpinnerProps) -> Element {
Icon { Icon {
class: if props.animate { "" } else { ClassName::PAUSED }, class: if props.animate { "" } else { ClassName::PAUSED },
icon: _Spinner, icon: LogoShape,
} }
} }
} }