use dioxus::prelude::{render, Element, Props, Scope};
use freya_elements::elements as dioxus_elements;
use freya_hooks::{use_applied_theme, CanvasTheme, CanvasThemeWith, UseCanvas};
#[derive(Props, PartialEq)]
pub struct CanvasProps {
pub theme: Option<CanvasThemeWith>,
pub canvas: UseCanvas,
}
#[allow(non_snake_case)]
pub fn Canvas(cx: Scope<CanvasProps>) -> Element {
let CanvasTheme {
width,
height,
background,
} = use_applied_theme!(cx, &cx.props.theme, canvas);
render!(rect {
overflow: "clip",
canvas_reference: cx.props.canvas.attribute(cx),
background: "{background}",
width: "{width}",
height: "{height}"
})
}