1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use yew::{Component, ComponentLink, Html};
use yew::prelude::*;
pub fn get_css<'a>() -> &'a str {
"
.jinya-page {
margin-left: 10%;
margin-right: 10%;
margin-top: 1.5rem;
}
"
}
pub struct Page {
children: Children,
}
#[derive(Clone, PartialEq, Properties)]
pub struct PageProps {
pub children: Children
}
impl Component for Page {
type Message = ();
type Properties = PageProps;
fn create(props: Self::Properties, _link: ComponentLink<Self>) -> Self {
Page {
children: props.children,
}
}
fn update(&mut self, _msg: Self::Message) -> bool {
false
}
fn change(&mut self, _props: Self::Properties) -> bool {
self.children = _props.children;
true
}
fn view(&self) -> Html {
html! {
<div class="jinya-page">
{for self.children.iter().enumerate().map(|(_, mut child)| {
child
})}
</div>
}
}
}