1use crate::prelude::*;
2use crate::theme;
3
4#[derive(Clone)]
5pub struct ToolbarItem {}
6
7#[derive(Element)]
8pub struct Toolbar<S: 'static + Send + Sync> {
9 left_items: HackyChildren<S>,
10 left_items_payload: HackyChildrenPayload,
11 right_items: HackyChildren<S>,
12 right_items_payload: HackyChildrenPayload,
13}
14
15impl<S: 'static + Send + Sync> Toolbar<S> {
16 pub fn new(
17 left_items: HackyChildren<S>,
18 left_items_payload: HackyChildrenPayload,
19 right_items: HackyChildren<S>,
20 right_items_payload: HackyChildrenPayload,
21 ) -> Self {
22 Self {
23 left_items,
24 left_items_payload,
25 right_items,
26 right_items_payload,
27 }
28 }
29
30 fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
31 let theme = theme(cx);
32
33 div()
34 .fill(theme.highest.base.default.background)
35 .p_2()
36 .flex()
37 .justify_between()
38 .child(
39 div()
40 .flex()
41 .children_any((self.left_items)(cx, self.left_items_payload.as_ref())),
42 )
43 .child(
44 div()
45 .flex()
46 .children_any((self.right_items)(cx, self.right_items_payload.as_ref())),
47 )
48 }
49}