1use std::marker::PhantomData;
2
3use crate::prelude::*;
4use crate::{
5 static_project_panel_project_items, static_project_panel_single_items, theme, Input, List,
6 ListHeader,
7};
8
9#[derive(Element)]
10pub struct ProjectPanel<V: 'static> {
11 view_type: PhantomData<V>,
12 scroll_state: ScrollState,
13}
14
15impl<V: 'static> ProjectPanel<V> {
16 pub fn new(scroll_state: ScrollState) -> Self {
17 Self {
18 view_type: PhantomData,
19 scroll_state,
20 }
21 }
22
23 fn render(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
24 let theme = theme(cx);
25
26 div()
27 .flex()
28 .flex_col()
29 .w_full()
30 .h_full()
31 .px_2()
32 .fill(theme.middle.base.default.background)
33 .child(
34 div()
35 .w_56()
36 .flex()
37 .flex_col()
38 .overflow_y_scroll(ScrollState::default())
39 .child(
40 List::new(static_project_panel_single_items())
41 .header(ListHeader::new("FILES").set_toggle(ToggleState::Toggled))
42 .empty_message("No files in directory")
43 .set_toggle(ToggleState::Toggled),
44 )
45 .child(
46 List::new(static_project_panel_project_items())
47 .header(ListHeader::new("PROJECT").set_toggle(ToggleState::Toggled))
48 .empty_message("No folders in directory")
49 .set_toggle(ToggleState::Toggled),
50 ),
51 )
52 .child(
53 Input::new("Find something...")
54 .value("buffe".to_string())
55 .state(InteractionState::Focused),
56 )
57 }
58}