use crate::container::*;
use crate::*;
use yew::prelude::*;
#[doc("# The Canvas")]
#[doc("# Should be used for seting backgrounds displaying images")]
pub struct Canvas {
    link: ComponentLink<Self>,
    props: CanvasProperties,
}
#[derive(Properties, Clone, Debug, PartialEq)]
pub struct CanvasProperties {
    #[prop_or_default]
    pub is: Elem,
    #[prop_or_default]
    pub children: Children,
    #[prop_or_default]
    pub color: Color,
    #[prop_or_default]
    pub background_attachment: String,
    #[prop_or_default]
    pub background_color: Color,
    #[prop_or_default]
    pub background_image: String,
    #[prop_or_default]
    pub background_position: MultiValue<Unit>,
    #[prop_or_default]
    pub background_repeat: String,
    #[prop_or_default]
    pub background_size: Positional,
}
#[doc("Pane is for grahics setting backgrounds and images")]
impl Component for Canvas {
    type Message = ();
    type Properties = CanvasProperties;
    fn create(props: Self::Properties, link: ComponentLink<Self>) -> Self {
        Self { link, props }
    }
    fn update(&mut self, _msg: Self::Message) -> ShouldRender {
        true
    }
    fn change(&mut self, props: Self::Properties) -> ShouldRender {
        if self.props == props {
            return false;
        }
        self.props = props;
        true
    }
    fn view(&self) -> Html {
        html! {
            <Container is={Elem::Div}
                background_repeat=self.props.background_repeat.clone()
                background_position=self.props.background_position.clone()
                background_image=self.props.background_image.clone()
                background_attachment=self.props.background_attachment.clone()
                background_color=self.props.background_color.clone()
                color= self.props.color.clone()>
                {self.props.children.clone()}
            </Container>
        }
    }
}
