Add list items for scroll testing
This commit is contained in:
parent
85aedf9bed
commit
a3039ad95b
1 changed files with 178 additions and 170 deletions
|
@ -1,7 +1,7 @@
|
||||||
use crate::theme::{theme, Theme};
|
use crate::theme::{theme, Theme};
|
||||||
use gpui2::{
|
use gpui2::{
|
||||||
elements::{div, svg},
|
elements::div,
|
||||||
style::StyleHelpers,
|
style::{StyleHelpers, Styleable},
|
||||||
Element, IntoElement, ParentElement, ViewContext,
|
Element, IntoElement, ParentElement, ViewContext,
|
||||||
};
|
};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
@ -17,62 +17,51 @@ pub fn collab_panel<V: 'static>() -> CollabPanelElement<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[derive(Element)]
|
|
||||||
// struct ListItem {
|
|
||||||
// label: Option<ArcCow<'static, str>>,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn list_item() -> ListItem {
|
|
||||||
// ListItem { label: None }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// impl ListItem {
|
|
||||||
// pub fn render<V: 'static>(
|
|
||||||
// &mut self,
|
|
||||||
// view: &mut V,
|
|
||||||
// cx: &mut ViewContext<Self>,
|
|
||||||
// ) -> impl Element<V> {
|
|
||||||
// let theme = theme(cx);
|
|
||||||
|
|
||||||
// div()
|
|
||||||
// .px_2()
|
|
||||||
// .flex()
|
|
||||||
// .justify_between()
|
|
||||||
// .hover()
|
|
||||||
// .fill(theme.middle.variant.hovered.background)
|
|
||||||
// .active()
|
|
||||||
// .fill(theme.middle.variant.pressed.background)
|
|
||||||
// .child(div().flex().gap_1().child("#").child(self.label))
|
|
||||||
// .child(div().flex().gap_1().child("v"))
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn label(mut self, label: impl Into<ArcCow<'static, str>>) -> Self {
|
|
||||||
// self.label = Some(label.into());
|
|
||||||
// self
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn list_item<V: 'static>(cx: &mut ViewContext<V>, label: &mut str) -> impl IntoElement<V> {
|
|
||||||
// let theme = theme(cx);
|
|
||||||
// div()
|
|
||||||
// .px_2()
|
|
||||||
// .flex()
|
|
||||||
// .justify_between()
|
|
||||||
// //:: States - https://tailwindcss.com/docs/hover-focus-and-other-states#hover-focus-and-active
|
|
||||||
// .hover()
|
|
||||||
// .fill(theme.middle.variant.hovered.background)
|
|
||||||
// .active()
|
|
||||||
// .fill(theme.middle.variant.pressed.background)
|
|
||||||
// .child(div().flex().gap_1().child("#").child("Collab Panel"))
|
|
||||||
// .child(div().flex().gap_1().child("v"))
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Macros to impl:
|
|
||||||
// - border (b, t, l, r, x, y)
|
|
||||||
// - border_[foo]_[size] (border_b_2, border_t_4, etc)
|
|
||||||
// - border_color
|
|
||||||
|
|
||||||
impl<V: 'static> CollabPanelElement<V> {
|
impl<V: 'static> CollabPanelElement<V> {
|
||||||
|
fn list_section_header(&self, theme: &Theme) -> impl Element<V> {
|
||||||
|
div()
|
||||||
|
.h_7()
|
||||||
|
.px_2()
|
||||||
|
.flex()
|
||||||
|
.justify_between()
|
||||||
|
.items_center()
|
||||||
|
.child(div().flex().gap_1().text_sm().child("CHANNELS"))
|
||||||
|
.child(
|
||||||
|
div().flex().h_full().gap_1().items_center().child(
|
||||||
|
div()
|
||||||
|
.w_3p5()
|
||||||
|
.h_3p5()
|
||||||
|
.fill(theme.middle.positive.default.foreground),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn list_item_channel(&self, theme: &Theme) -> impl Element<V> {
|
||||||
|
div()
|
||||||
|
.h_7()
|
||||||
|
.px_2()
|
||||||
|
.flex()
|
||||||
|
.items_center()
|
||||||
|
.hover()
|
||||||
|
.fill(theme.lowest.variant.hovered.background)
|
||||||
|
.active()
|
||||||
|
.fill(theme.lowest.variant.pressed.background)
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.flex()
|
||||||
|
.items_center()
|
||||||
|
.gap_1()
|
||||||
|
.text_sm()
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.w_3p5()
|
||||||
|
.h_3p5()
|
||||||
|
.fill(theme.middle.positive.default.foreground),
|
||||||
|
)
|
||||||
|
.child("zed-industries"),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn render(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
|
fn render(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
|
@ -82,9 +71,14 @@ impl<V: 'static> CollabPanelElement<V> {
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
.font("Zed Sans Extended")
|
.font("Zed Sans Extended")
|
||||||
.text_color(theme.middle.variant.default.foreground)
|
.text_color(theme.middle.base.default.foreground)
|
||||||
// .border_color(theme.middle.base.default.border)
|
// .border_color(theme.middle.base.default.border)
|
||||||
.fill(theme.middle.base.default.background)
|
.fill(theme.middle.base.default.background)
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.full()
|
||||||
|
.flex()
|
||||||
|
.flex_col()
|
||||||
// List Container
|
// List Container
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
|
@ -100,10 +94,10 @@ impl<V: 'static> CollabPanelElement<V> {
|
||||||
.flex()
|
.flex()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.items_center()
|
.items_center()
|
||||||
// .hover()
|
.hover()
|
||||||
// .fill(theme.middle.variant.hovered.background)
|
.fill(theme.lowest.variant.hovered.background)
|
||||||
// .active()
|
.active()
|
||||||
// .fill(theme.middle.variant.pressed.background)
|
.fill(theme.lowest.variant.pressed.background)
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
|
@ -116,11 +110,10 @@ impl<V: 'static> CollabPanelElement<V> {
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div().flex().h_full().gap_1().items_center().child(
|
div().flex().h_full().gap_1().items_center().child(
|
||||||
svg()
|
div()
|
||||||
.path("icons/radix/caret-down.svg")
|
.w_3p5()
|
||||||
.h_3()
|
.h_3p5()
|
||||||
.w_3()
|
.fill(theme.middle.positive.default.foreground),
|
||||||
.fill(theme.middle.variant.default.foreground),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -157,19 +150,15 @@ impl<V: 'static> CollabPanelElement<V> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.child(self.list_section_header(theme))
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.w_full()
|
.py_2()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
.gap_y_1()
|
|
||||||
// List Section Header
|
|
||||||
.child(self.list_section_header(theme)),
|
|
||||||
)
|
|
||||||
// Large List Item
|
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.h_7()
|
.h_5()
|
||||||
.px_2()
|
.px_2()
|
||||||
.flex()
|
.flex()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
|
@ -184,22 +173,41 @@ impl<V: 'static> CollabPanelElement<V> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
fn list_section_header(&self, theme: &Theme) -> impl Element<V> {
|
.child(self.list_item_channel(theme))
|
||||||
div()
|
.child(self.list_item_channel(theme))
|
||||||
.h_7()
|
.child(self.list_item_channel(theme))
|
||||||
.px_2()
|
.child(self.list_item_channel(theme))
|
||||||
.flex()
|
.child(self.list_item_channel(theme))
|
||||||
.justify_between()
|
.child(self.list_item_channel(theme))
|
||||||
.items_center()
|
.child(self.list_item_channel(theme))
|
||||||
.child(div().flex().gap_1().text_sm().child("CHANNELS"))
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme))
|
||||||
|
.child(self.list_item_channel(theme)),
|
||||||
|
),
|
||||||
|
)
|
||||||
.child(
|
.child(
|
||||||
div().flex().h_full().gap_1().items_center().child(
|
div().h_7().px_2().flex().items_center().child(
|
||||||
div()
|
div()
|
||||||
.w_3p5()
|
.text_sm()
|
||||||
.h_3p5()
|
.text_color(theme.middle.variant.default.foreground)
|
||||||
.fill(theme.middle.positive.default.foreground),
|
.child("Find..."),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue