From 7078f86cd846b738bbeb4e8ded5bbc5f63a87326 Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 26 Apr 2024 19:31:05 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Make=20the=20"logo"=20shape=20re?= =?UTF-8?q?usable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/components/icons.rs | 24 ++++++++++++++++++++++-- src/ui/components/spinner.rs | 26 ++++---------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/ui/components/icons.rs b/src/ui/components/icons.rs index d15a782..c79de79 100644 --- a/src/ui/components/icons.rs +++ b/src/ui/components/icons.rs @@ -10,12 +10,32 @@ include!(concat!(env!("OUT_DIR"), "/style_vars.rs")); use style::{COLOR_PRIMARY_100, COLOR_TERNARY_100}; 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! { style { {STYLE_SHEET} }, Icon { - class: ClassName::DOWN_ARROW_ICON, - icon: MdArrowDropDown, + icon: LogoShape, } } } diff --git a/src/ui/components/spinner.rs b/src/ui/components/spinner.rs index 91ef65c..68750b1 100644 --- a/src/ui/components/spinner.rs +++ b/src/ui/components/spinner.rs @@ -1,28 +1,10 @@ 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"); -#[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)] pub struct SpinnerProps { #[props(default = true)] @@ -38,7 +20,7 @@ pub fn Spinner(props: SpinnerProps) -> Element { Icon { class: if props.animate { "" } else { ClassName::PAUSED }, - icon: _Spinner, + icon: LogoShape, } } }