46 lines
1.0 KiB
Rust
46 lines
1.0 KiB
Rust
use dioxus::prelude::*;
|
|
use dioxus_free_icons::{Icon, IconShape};
|
|
|
|
turf::style_sheet!("src/components/spinner.scss");
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
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) -> LazyNodes {
|
|
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, Props)]
|
|
pub struct SpinnerProps {
|
|
#[props(default = true)]
|
|
animate: bool,
|
|
}
|
|
|
|
pub fn Spinner(cx: Scope<SpinnerProps>) -> Element {
|
|
cx.render(rsx! {
|
|
style { STYLE_SHEET },
|
|
|
|
div {
|
|
class: ClassName::SPINNER,
|
|
|
|
Icon {
|
|
class: if cx.props.animate { "" } else { ClassName::PAUSED },
|
|
icon: _Spinner,
|
|
}
|
|
}
|
|
})
|
|
}
|