use dioxus::{core::AttributeValue, prelude::*};
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "/build/mwc-circular-progress.js")]
extern "C" {
#[derive(Debug)]
type CircularProgress;
#[wasm_bindgen(getter, static_method_of = CircularProgress)]
fn _dummy_loader() -> JsValue;
}
loader_hack!(CircularProgress);
#[derive(Props, PartialEq)]
pub struct CircularProgressProps {
#[props(default)]
pub indeterminate: bool,
#[props(default)]
pub progress: f32,
#[props(default)]
pub density: u32,
#[props(default)]
pub closed: bool,
}
fn render(cx: Scope<CircularProgressProps>) -> Element {
render! {
mwc-circular-progress {
"indeterminate": bool_attr!(cx.props.indeterminate),
"progress": AttributeValue::Float(cx.props.progress.into()),
"density": AttributeValue::Int(cx.props.density.into()),
"closed": bool_attr!(cx.props.closed),
}
}
}
component!(
MatCircularProgress,
CircularProgressProps,
render,
CircularProgress,
"circular-progress"
);