Render Panel
This commit is contained in:
@@ -39,8 +39,9 @@ pub enum PanelSide {
|
|||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
// #[derive(Element)]
|
#[derive(Element)]
|
||||||
pub struct Panel {
|
pub struct Panel<S: 'static + Send + Sync> {
|
||||||
|
state_type: PhantomData<S>,
|
||||||
scroll_state: ScrollState,
|
scroll_state: ScrollState,
|
||||||
current_side: PanelSide,
|
current_side: PanelSide,
|
||||||
/// Defaults to PanelAllowedSides::LeftAndRight
|
/// Defaults to PanelAllowedSides::LeftAndRight
|
||||||
@@ -51,7 +52,7 @@ pub struct Panel {
|
|||||||
// payload: HackyChildrenPayload,
|
// payload: HackyChildrenPayload,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Panel {
|
impl<S: 'static + Send + Sync> Panel<S> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
scroll_state: ScrollState,
|
scroll_state: ScrollState,
|
||||||
// children: HackyChildren<S>,
|
// children: HackyChildren<S>,
|
||||||
@@ -60,6 +61,7 @@ impl Panel {
|
|||||||
let token = token();
|
let token = token();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
state_type: PhantomData,
|
||||||
scroll_state,
|
scroll_state,
|
||||||
current_side: PanelSide::default(),
|
current_side: PanelSide::default(),
|
||||||
allowed_sides: PanelAllowedSides::default(),
|
allowed_sides: PanelAllowedSides::default(),
|
||||||
@@ -99,7 +101,7 @@ impl Panel {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render<S: 'static + Send + Sync>(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
|
fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
|
||||||
let token = token();
|
let token = token();
|
||||||
let theme = rose_pine_dawn();
|
let theme = rose_pine_dawn();
|
||||||
|
|
||||||
@@ -112,7 +114,7 @@ impl Panel {
|
|||||||
.flex_initial()
|
.flex_initial()
|
||||||
.h_full()
|
.h_full()
|
||||||
// .w(current_width)
|
// .w(current_width)
|
||||||
.w_4()
|
.w_64()
|
||||||
.fill(theme.middle.base.default.background)
|
.fill(theme.middle.base.default.background)
|
||||||
.border_r()
|
.border_r()
|
||||||
.border_color(theme.middle.base.default.border);
|
.border_color(theme.middle.base.default.border);
|
||||||
@@ -122,7 +124,7 @@ impl Panel {
|
|||||||
.flex_initial()
|
.flex_initial()
|
||||||
.h_full()
|
.h_full()
|
||||||
// .w(current_width)
|
// .w(current_width)
|
||||||
.w_4()
|
.w_64()
|
||||||
.fill(theme.middle.base.default.background)
|
.fill(theme.middle.base.default.background)
|
||||||
.border_l()
|
.border_l()
|
||||||
.border_color(theme.middle.base.default.border);
|
.border_color(theme.middle.base.default.border);
|
||||||
@@ -132,7 +134,7 @@ impl Panel {
|
|||||||
.flex_initial()
|
.flex_initial()
|
||||||
.w_full()
|
.w_full()
|
||||||
// .h(current_width)
|
// .h(current_width)
|
||||||
.h_4()
|
.h_64()
|
||||||
.fill(theme.middle.base.default.background)
|
.fill(theme.middle.base.default.background)
|
||||||
.border_t()
|
.border_t()
|
||||||
.border_color(theme.middle.base.default.border);
|
.border_color(theme.middle.base.default.border);
|
||||||
|
|||||||
@@ -30,57 +30,59 @@ impl Workspace {
|
|||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<State = Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<State = Self> {
|
||||||
let theme = rose_pine_dawn();
|
let theme = rose_pine_dawn();
|
||||||
|
|
||||||
// div()
|
|
||||||
// .size_full()
|
|
||||||
// .v_stack()
|
|
||||||
// .fill(theme.lowest.base.default.background)
|
|
||||||
// .child(Panel::new(ScrollState::default()))
|
|
||||||
// .child(
|
|
||||||
// div()
|
|
||||||
// .size_full()
|
|
||||||
// .h_stack()
|
|
||||||
// .gap_3()
|
|
||||||
// .children((0..4).map(|i| {
|
|
||||||
// div().size_full().flex().fill(gpui3::hsla(
|
|
||||||
// 0. + (i as f32 / 7.),
|
|
||||||
// 0. + (i as f32 / 5.),
|
|
||||||
// 0.5,
|
|
||||||
// 1.,
|
|
||||||
// ))
|
|
||||||
// })),
|
|
||||||
// )
|
|
||||||
// .child(
|
|
||||||
// div()
|
|
||||||
// .size_full()
|
|
||||||
// .flex()
|
|
||||||
// .fill(theme.middle.negative.default.background),
|
|
||||||
// )
|
|
||||||
|
|
||||||
themed(rose_pine_dawn(), cx, |cx| {
|
themed(rose_pine_dawn(), cx, |cx| {
|
||||||
div()
|
div()
|
||||||
.size_full()
|
.size_full()
|
||||||
.flex()
|
.v_stack()
|
||||||
.flex_col()
|
.fill(theme.lowest.base.default.background)
|
||||||
.font("Courier")
|
.child(Panel::new(ScrollState::default()))
|
||||||
.gap_0()
|
|
||||||
.justify_start()
|
|
||||||
.items_start()
|
|
||||||
.text_color(theme.lowest.base.default.foreground)
|
|
||||||
.fill(theme.middle.base.default.background)
|
|
||||||
.child(titlebar(cx))
|
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.flex_1()
|
.size_full()
|
||||||
.w_full()
|
.h_stack()
|
||||||
|
.gap_3()
|
||||||
|
.children((0..4).map(|i| {
|
||||||
|
div().size_full().flex().fill(gpui3::hsla(
|
||||||
|
0. + (i as f32 / 7.),
|
||||||
|
0. + (i as f32 / 5.),
|
||||||
|
0.5,
|
||||||
|
1.,
|
||||||
|
))
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.size_full()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_row()
|
.fill(theme.middle.negative.default.background),
|
||||||
.overflow_hidden()
|
|
||||||
.child(self.left_panel.clone())
|
|
||||||
.child(div().h_full().flex_1())
|
|
||||||
.child(self.right_panel.clone()),
|
|
||||||
)
|
)
|
||||||
.child(statusbar::statusbar(cx))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// themed(rose_pine_dawn(), cx, |cx| {
|
||||||
|
// div()
|
||||||
|
// .size_full()
|
||||||
|
// .flex()
|
||||||
|
// .flex_col()
|
||||||
|
// .font("Courier")
|
||||||
|
// .gap_0()
|
||||||
|
// .justify_start()
|
||||||
|
// .items_start()
|
||||||
|
// .text_color(theme.lowest.base.default.foreground)
|
||||||
|
// .fill(theme.middle.base.default.background)
|
||||||
|
// .child(titlebar(cx))
|
||||||
|
// .child(
|
||||||
|
// div()
|
||||||
|
// .flex_1()
|
||||||
|
// .w_full()
|
||||||
|
// .flex()
|
||||||
|
// .flex_row()
|
||||||
|
// .overflow_hidden()
|
||||||
|
// .child(self.left_panel.clone())
|
||||||
|
// .child(div().h_full().flex_1())
|
||||||
|
// .child(self.right_panel.clone()),
|
||||||
|
// )
|
||||||
|
// .child(statusbar::statusbar(cx))
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user