design_system/footer/
footer.rs1use css_in_rust::Style;
2use yew::{html, Classes, Component, ComponentLink, Html, Properties, ShouldRender};
3
4pub struct Footer {
6 props: Props,
7 style: Style,
8}
9
10#[derive(Properties, Clone, PartialEq)]
11pub struct Props {
12 #[prop_or_default]
13 pub class: String,
14}
15
16pub enum Msg {}
17
18impl Component for Footer {
19 type Message = Msg;
20 type Properties = Props;
21
22 fn create(props: Self::Properties, _link: ComponentLink<Self>) -> Self {
23 let style = Style::create(
24 String::from("footer"),
25 String::from(
26 r#"
27 background-color: rgb(var(--color-fg));
28 color: rgb(var(--color-bg));
29 padding: 7px 5px 2px 5px;
30 "#,
31 ),
32 )
33 .expect("An error occured while creating the style.");
34 Self { props, style }
35 }
36
37 fn update(&mut self, _msg: Self::Message) -> ShouldRender {
38 true
39 }
40
41 fn change(&mut self, props: Self::Properties) -> ShouldRender {
42 if self.props != props {
43 self.props = props;
44 true
45 } else {
46 false
47 }
48 }
49
50 fn view(&self) -> Html {
51 html! {
52 <div class=Classes::from(self.props.class.to_string()).extend(self.style.to_string())>
53 <p>{"ANNA - An Open Marketplace Application"}</p>
54 </div>
55 }
56 }
57}