🎨 Isolate infra and ui components
The src/base.rs is still to be reworked.
This commit is contained in:
45
src/ui/components/spinner.rs
Normal file
45
src/ui/components/spinner.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_free_icons::{Icon, IconShape};
|
||||
|
||||
turf::style_sheet!("src/ui/components/spinner.scss");
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
struct _Spinner;
|
||||
impl IconShape for _Spinner {
|
||||
fn view_box(&self) -> String {
|
||||
String::from("0 0 184 94")
|
||||
}
|
||||
fn xmlns(&self) -> String {
|
||||
String::from("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)]
|
||||
animate: bool,
|
||||
}
|
||||
|
||||
pub fn Spinner(props: SpinnerProps) -> Element {
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
|
||||
div {
|
||||
class: ClassName::SPINNER,
|
||||
|
||||
Icon {
|
||||
class: if props.animate { "" } else { ClassName::PAUSED },
|
||||
icon: _Spinner,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user