Unified · Split
| @@ -39,8 +39,9 @@ pub enum PanelSide { · 38 unmodified lines | ||
| 39 | 39 | |
| 40 | 40 | use std::collections::HashSet; |
| 41 | 41 | |
| 42 | −// #[derive(Element)] | |
| 43 | −pub struct Panel { | |
| 42 | +#[derive(Element)] | |
| 43 | +pub struct Panel<S: 'static + Send + Sync> { | |
| 44 | + state_type: PhantomData<S>, | |
| 44 | 45 | scroll_state: ScrollState, |
| 45 | 46 | current_side: PanelSide, |
| 46 | 47 | /// Defaults to PanelAllowedSides::LeftAndRight |
| @@ -51,7 +52,7 @@ pub struct Panel { · 4 unmodified lines | ||
| 51 | 52 | // payload: HackyChildrenPayload, |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | −impl Panel { | |
| 55 | +impl<S: 'static + Send + Sync> Panel<S> { | |
| 55 | 56 | pub fn new( |
| 56 | 57 | scroll_state: ScrollState, |
| 57 | 58 | // children: HackyChildren<S>, |
| @@ -60,6 +61,7 @@ impl Panel { · 2 unmodified lines | ||
| 60 | 61 | let token = token(); |
| 61 | 62 | |
| 62 | 63 | Self { |
| 64 | + state_type: PhantomData, | |
| 63 | 65 | scroll_state, |
| 64 | 66 | current_side: PanelSide::default(), |
| 65 | 67 | allowed_sides: PanelAllowedSides::default(), |
| @@ -99,7 +101,7 @@ impl Panel { · 33 unmodified lines | ||
| 99 | 101 | self |
| 100 | 102 | } |
| 101 | 103 | |
| 102 | − fn render<S: 'static + Send + Sync>(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> { | |
| 104 | + fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> { | |
| 103 | 105 | let token = token(); |
| 104 | 106 | let theme = rose_pine_dawn(); |
| 105 | 107 | |
| @@ -112,7 +114,7 @@ impl Panel { · 6 unmodified lines | ||
| 112 | 114 | .flex_initial() |
| 113 | 115 | .h_full() |
| 114 | 116 | // .w(current_width) |
| 115 | − .w_4() | |
| 117 | + .w_64() | |
| 116 | 118 | .fill(theme.middle.base.default.background) |
| 117 | 119 | .border_r() |
| 118 | 120 | .border_color(theme.middle.base.default.border); |
| @@ -122,7 +124,7 @@ impl Panel { · 3 unmodified lines | ||
| 122 | 124 | .flex_initial() |
| 123 | 125 | .h_full() |
| 124 | 126 | // .w(current_width) |
| 125 | − .w_4() | |
| 127 | + .w_64() | |
| 126 | 128 | .fill(theme.middle.base.default.background) |
| 127 | 129 | .border_l() |
| 128 | 130 | .border_color(theme.middle.base.default.border); |
| @@ -132,7 +134,7 @@ impl Panel { · 3 unmodified lines | ||
| 132 | 134 | .flex_initial() |
| 133 | 135 | .w_full() |
| 134 | 136 | // .h(current_width) |
| 135 | − .h_4() | |
| 137 | + .h_64() | |
| 136 | 138 | .fill(theme.middle.base.default.background) |
| 137 | 139 | .border_t() |
| 138 | 140 | .border_color(theme.middle.base.default.border); |
| @@ -30,57 +30,59 @@ impl Workspace { · 29 unmodified lines | ||
| 30 | 30 | fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<State = Self> { |
| 31 | 31 | let theme = rose_pine_dawn(); |
| 32 | 32 | |
| 33 | − // div() | |
| 34 | − // .size_full() | |
| 35 | − // .v_stack() | |
| 36 | − // .fill(theme.lowest.base.default.background) | |
| 37 | − // .child(Panel::new(ScrollState::default())) | |
| 38 | − // .child( | |
| 39 | − // div() | |
| 40 | − // .size_full() | |
| 41 | − // .h_stack() | |
| 42 | − // .gap_3() | |
| 43 | − // .children((0..4).map(|i| { | |
| 44 | − // div().size_full().flex().fill(gpui3::hsla( | |
| 45 | − // 0. + (i as f32 / 7.), | |
| 46 | − // 0. + (i as f32 / 5.), | |
| 47 | − // 0.5, | |
| 48 | − // 1., | |
| 49 | − // )) | |
| 50 | − // })), | |
| 51 | − // ) | |
| 52 | − // .child( | |
| 53 | − // div() | |
| 54 | − // .size_full() | |
| 55 | − // .flex() | |
| 56 | − // .fill(theme.middle.negative.default.background), | |
| 57 | − // ) | |
| 58 | − | |
| 59 | 33 | themed(rose_pine_dawn(), cx, |cx| { |
| 60 | 34 | div() |
| 61 | 35 | .size_full() |
| 62 | − .flex() | |
| 63 | − .flex_col() | |
| 64 | − .font("Courier") | |
| 65 | − .gap_0() | |
| 66 | − .justify_start() | |
| 67 | − .items_start() | |
| 68 | − .text_color(theme.lowest.base.default.foreground) | |
| 69 | − .fill(theme.middle.base.default.background) | |
| 70 | − .child(titlebar(cx)) | |
| 36 | + .v_stack() | |
| 37 | + .fill(theme.lowest.base.default.background) | |
| 38 | + .child(Panel::new(ScrollState::default())) | |
| 71 | 39 | .child( |
| 72 | 40 | div() |
| 73 | − .flex_1() | |
| 74 | − .w_full() | |
| 41 | + .size_full() | |
| 42 | + .h_stack() | |
| 43 | + .gap_3() | |
| 44 | + .children((0..4).map(|i| { | |
| 45 | + div().size_full().flex().fill(gpui3::hsla( | |
| 46 | + 0. + (i as f32 / 7.), | |
| 47 | + 0. + (i as f32 / 5.), | |
| 48 | + 0.5, | |
| 49 | + 1., | |
| 50 | + )) | |
| 51 | + })), | |
| 52 | + ) | |
| 53 | + .child( | |
| 54 | + div() | |
| 55 | + .size_full() | |
| 75 | 56 | .flex() |
| 76 | − .flex_row() | |
| 77 | − .overflow_hidden() | |
| 78 | − .child(self.left_panel.clone()) | |
| 79 | − .child(div().h_full().flex_1()) | |
| 80 | − .child(self.right_panel.clone()), | |
| 57 | + .fill(theme.middle.negative.default.background), | |
| 81 | 58 | ) |
| 82 | − .child(statusbar::statusbar(cx)) | |
| 83 | 59 | }) |
| 60 | + | |
| 61 | + // themed(rose_pine_dawn(), cx, |cx| { | |
| 62 | + // div() | |
| 63 | + // .size_full() | |
| 64 | + // .flex() | |
| 65 | + // .flex_col() | |
| 66 | + // .font("Courier") | |
| 67 | + // .gap_0() | |
| 68 | + // .justify_start() | |
| 69 | + // .items_start() | |
| 70 | + // .text_color(theme.lowest.base.default.foreground) | |
| 71 | + // .fill(theme.middle.base.default.background) | |
| 72 | + // .child(titlebar(cx)) | |
| 73 | + // .child( | |
| 74 | + // div() | |
| 75 | + // .flex_1() | |
| 76 | + // .w_full() | |
| 77 | + // .flex() | |
| 78 | + // .flex_row() | |
| 79 | + // .overflow_hidden() | |
| 80 | + // .child(self.left_panel.clone()) | |
| 81 | + // .child(div().h_full().flex_1()) | |
| 82 | + // .child(self.right_panel.clone()), | |
| 83 | + // ) | |
| 84 | + // .child(statusbar::statusbar(cx)) | |
| 85 | + // }) | |
| 84 | 86 | } |
| 85 | 87 | } |
| 86 | 88 | |