Refine project panel, list
This commit is contained in:
parent
b6a9c58994
commit
0d8c743dfe
7 changed files with 199 additions and 185 deletions
|
@ -14,9 +14,9 @@ impl<S: 'static + Send + Sync + Clone> ContextMenuItem<S> {
|
||||||
fn to_list_item(self) -> ListItem<S> {
|
fn to_list_item(self) -> ListItem<S> {
|
||||||
match self {
|
match self {
|
||||||
ContextMenuItem::Header(label) => ListSubHeader::new(label).into(),
|
ContextMenuItem::Header(label) => ListSubHeader::new(label).into(),
|
||||||
ContextMenuItem::Entry(label) => {
|
ContextMenuItem::Entry(label) => ListEntry::new(label)
|
||||||
ListEntry::new(label).variant(ListItemVariant::Inset).into()
|
.set_variant(ListItemVariant::Inset)
|
||||||
}
|
.into(),
|
||||||
ContextMenuItem::Separator => ListSeparator::new().into(),
|
ContextMenuItem::Separator => ListSeparator::new().into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ use crate::{
|
||||||
#[derive(Clone, Copy, Default, Debug, PartialEq)]
|
#[derive(Clone, Copy, Default, Debug, PartialEq)]
|
||||||
pub enum ListItemVariant {
|
pub enum ListItemVariant {
|
||||||
/// The list item extends to the far left and right of the list.
|
/// The list item extends to the far left and right of the list.
|
||||||
#[default]
|
|
||||||
FullWidth,
|
FullWidth,
|
||||||
|
#[default]
|
||||||
Inset,
|
Inset,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ impl<S: 'static + Send + Sync + Clone> ListHeader<S> {
|
||||||
left_icon: None,
|
left_icon: None,
|
||||||
variant: ListItemVariant::default(),
|
variant: ListItemVariant::default(),
|
||||||
state: InteractionState::default(),
|
state: InteractionState::default(),
|
||||||
toggleable: Toggleable::default(),
|
toggleable: Toggleable::Toggleable(ToggleState::Toggled),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,8 +65,16 @@ impl<S: 'static + Send + Sync + Clone> ListHeader<S> {
|
||||||
|
|
||||||
match (is_toggleable, is_toggled) {
|
match (is_toggleable, is_toggled) {
|
||||||
(false, _) => div(),
|
(false, _) => div(),
|
||||||
(_, true) => div().child(IconElement::new(Icon::ChevronRight).color(IconColor::Muted)),
|
(_, true) => div().child(
|
||||||
(_, false) => div().child(IconElement::new(Icon::ChevronDown).size(IconSize::Small)),
|
IconElement::new(Icon::ChevronDown)
|
||||||
|
.color(IconColor::Muted)
|
||||||
|
.size(IconSize::Small),
|
||||||
|
),
|
||||||
|
(_, false) => div().child(
|
||||||
|
IconElement::new(Icon::ChevronRight)
|
||||||
|
.color(IconColor::Muted)
|
||||||
|
.size(IconSize::Small),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,10 +124,9 @@ impl<S: 'static + Send + Sync + Clone> ListHeader<S> {
|
||||||
.border_color(theme.lowest.accent.default.border)
|
.border_color(theme.lowest.accent.default.border)
|
||||||
})
|
})
|
||||||
.relative()
|
.relative()
|
||||||
.py_1()
|
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.h_6()
|
.h_5()
|
||||||
.when(self.variant == ListItemVariant::Inset, |this| this.px_2())
|
.when(self.variant == ListItemVariant::Inset, |this| this.px_2())
|
||||||
.flex()
|
.flex()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
|
@ -287,14 +294,16 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
||||||
left_content: None,
|
left_content: None,
|
||||||
size: ListEntrySize::default(),
|
size: ListEntrySize::default(),
|
||||||
state: InteractionState::default(),
|
state: InteractionState::default(),
|
||||||
|
// TODO: Should use Toggleable::NotToggleable
|
||||||
|
// or remove Toggleable::NotToggleable from the system
|
||||||
toggle: None,
|
toggle: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn variant(mut self, variant: ListItemVariant) -> Self {
|
pub fn set_variant(mut self, variant: ListItemVariant) -> Self {
|
||||||
self.variant = variant;
|
self.variant = variant;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
pub fn indent_level(mut self, indent_level: u32) -> Self {
|
pub fn set_indent_level(mut self, indent_level: u32) -> Self {
|
||||||
self.indent_level = indent_level;
|
self.indent_level = indent_level;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -304,32 +313,32 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn left_content(mut self, left_content: LeftContent) -> Self {
|
pub fn set_left_content(mut self, left_content: LeftContent) -> Self {
|
||||||
self.left_content = Some(left_content);
|
self.left_content = Some(left_content);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn left_icon(mut self, left_icon: Icon) -> Self {
|
pub fn set_left_icon(mut self, left_icon: Icon) -> Self {
|
||||||
self.left_content = Some(LeftContent::Icon(left_icon));
|
self.left_content = Some(LeftContent::Icon(left_icon));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn left_avatar(mut self, left_avatar: &'static str) -> Self {
|
pub fn set_left_avatar(mut self, left_avatar: &'static str) -> Self {
|
||||||
self.left_content = Some(LeftContent::Avatar(left_avatar));
|
self.left_content = Some(LeftContent::Avatar(left_avatar));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn state(mut self, state: InteractionState) -> Self {
|
pub fn set_state(mut self, state: InteractionState) -> Self {
|
||||||
self.state = state;
|
self.state = state;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn size(mut self, size: ListEntrySize) -> Self {
|
pub fn set_size(mut self, size: ListEntrySize) -> Self {
|
||||||
self.size = size;
|
self.size = size;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn disclosure_control_style(
|
pub fn set_disclosure_control_style(
|
||||||
mut self,
|
mut self,
|
||||||
disclosure_control_style: DisclosureControlVisibility,
|
disclosure_control_style: DisclosureControlVisibility,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
@ -390,12 +399,16 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
let token = token();
|
let token = token();
|
||||||
let system_color = SystemColor::new();
|
let system_color = SystemColor::new();
|
||||||
let background_color = self.background_color(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
let left_content = match self.left_content {
|
let left_content = match self.left_content {
|
||||||
Some(LeftContent::Icon(i)) => {
|
Some(LeftContent::Icon(i)) => Some(
|
||||||
Some(h_stack().child(IconElement::new(i).size(IconSize::Small)))
|
h_stack().child(
|
||||||
}
|
IconElement::new(i)
|
||||||
|
.size(IconSize::Small)
|
||||||
|
.color(IconColor::Muted),
|
||||||
|
),
|
||||||
|
),
|
||||||
Some(LeftContent::Avatar(src)) => Some(h_stack().child(Avatar::new(src))),
|
Some(LeftContent::Avatar(src)) => Some(h_stack().child(Avatar::new(src))),
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
@ -406,13 +419,11 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
||||||
};
|
};
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.fill(background_color)
|
|
||||||
.when(self.state == InteractionState::Focused, |this| {
|
|
||||||
this.border()
|
|
||||||
.border_color(theme.lowest.accent.default.border)
|
|
||||||
})
|
|
||||||
.relative()
|
.relative()
|
||||||
.py_1()
|
.fill(self.background_color(cx))
|
||||||
|
.when(self.state == InteractionState::Focused, |this| {
|
||||||
|
this.border().border_color(color.border_focused)
|
||||||
|
})
|
||||||
.child(
|
.child(
|
||||||
sized_item
|
sized_item
|
||||||
.when(self.variant == ListItemVariant::Inset, |this| this.px_2())
|
.when(self.variant == ListItemVariant::Inset, |this| this.px_2())
|
||||||
|
@ -423,9 +434,11 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
||||||
.h_full()
|
.h_full()
|
||||||
.flex()
|
.flex()
|
||||||
.justify_center()
|
.justify_center()
|
||||||
.child(h_stack().child(div().w_px().h_full()).child(
|
.child(
|
||||||
div().w_px().h_full().fill(theme.middle.base.default.border),
|
h_stack()
|
||||||
))
|
.child(div().w_px().h_full())
|
||||||
|
.child(div().w_px().h_full().fill(color.border)),
|
||||||
|
)
|
||||||
}))
|
}))
|
||||||
.flex()
|
.flex()
|
||||||
.gap_1()
|
.gap_1()
|
||||||
|
@ -451,9 +464,9 @@ impl<S: 'static + Send + Sync> ListSeparator<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
|
fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
|
||||||
let theme = theme(cx);
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div().h_px().w_full().fill(theme.lowest.base.default.border)
|
div().h_px().w_full().fill(color.border)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,17 +22,17 @@ impl<S: 'static + Send + Sync + Clone> ProjectPanel<S> {
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
|
fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
let color = ThemeColor::new(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
.w_full()
|
.w_full()
|
||||||
.h_full()
|
.h_full()
|
||||||
.px_2()
|
.fill(color.panel_surface)
|
||||||
.fill(theme.middle.base.default.background)
|
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.w_56()
|
.w_full()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
.overflow_y_scroll(ScrollState::default())
|
.overflow_y_scroll(ScrollState::default())
|
||||||
|
|
|
@ -7,7 +7,6 @@ mod elements;
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
mod static_data;
|
mod static_data;
|
||||||
mod theme;
|
mod theme;
|
||||||
mod tokens;
|
|
||||||
|
|
||||||
pub use children::*;
|
pub use children::*;
|
||||||
pub use components::*;
|
pub use components::*;
|
||||||
|
@ -15,7 +14,6 @@ pub use element_ext::*;
|
||||||
pub use elements::*;
|
pub use elements::*;
|
||||||
pub use prelude::*;
|
pub use prelude::*;
|
||||||
pub use static_data::*;
|
pub use static_data::*;
|
||||||
pub use tokens::*;
|
|
||||||
|
|
||||||
pub use crate::theme::*;
|
pub use crate::theme::*;
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,32 @@ pub use gpui3::{
|
||||||
|
|
||||||
pub use crate::{theme, ButtonVariant, ElementExt, HackyChildren, HackyChildrenPayload, Theme};
|
pub use crate::{theme, ButtonVariant, ElementExt, HackyChildren, HackyChildrenPayload, Theme};
|
||||||
|
|
||||||
use gpui3::{hsla, rgb, Hsla};
|
use gpui3::{hsla, rems, rgb, AbsoluteLength, Hsla};
|
||||||
use strum::EnumIter;
|
use strum::EnumIter;
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
pub struct Token {
|
||||||
|
pub list_indent_depth: AbsoluteLength,
|
||||||
|
pub default_panel_size: AbsoluteLength,
|
||||||
|
pub state_hover_background: Hsla,
|
||||||
|
pub state_active_background: Hsla,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Token {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
list_indent_depth: AbsoluteLength::Rems(rems(0.3)),
|
||||||
|
default_panel_size: AbsoluteLength::Rems(rems(16.)),
|
||||||
|
state_hover_background: hsla(0.0, 0.0, 0.0, 0.08),
|
||||||
|
state_active_background: hsla(0.0, 0.0, 0.0, 0.16),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn token() -> Token {
|
||||||
|
Token::default()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct SystemColor {
|
pub struct SystemColor {
|
||||||
pub transparent: Hsla,
|
pub transparent: Hsla,
|
||||||
|
@ -34,8 +57,10 @@ impl SystemColor {
|
||||||
pub struct ThemeColor {
|
pub struct ThemeColor {
|
||||||
pub border: Hsla,
|
pub border: Hsla,
|
||||||
pub border_variant: Hsla,
|
pub border_variant: Hsla,
|
||||||
|
pub border_focused: Hsla,
|
||||||
/// The background color of an elevated surface, like a modal, tooltip or toast.
|
/// The background color of an elevated surface, like a modal, tooltip or toast.
|
||||||
pub elevated_surface: Hsla,
|
pub elevated_surface: Hsla,
|
||||||
|
pub panel_surface: Hsla,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ThemeColor {
|
impl ThemeColor {
|
||||||
|
@ -45,7 +70,9 @@ impl ThemeColor {
|
||||||
Self {
|
Self {
|
||||||
border: theme.lowest.base.default.border,
|
border: theme.lowest.base.default.border,
|
||||||
border_variant: theme.lowest.variant.default.border,
|
border_variant: theme.lowest.variant.default.border,
|
||||||
|
border_focused: theme.lowest.accent.default.border,
|
||||||
elevated_surface: theme.middle.base.default.background,
|
elevated_surface: theme.middle.base.default.background,
|
||||||
|
panel_surface: theme.middle.base.default.background,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,124 +324,124 @@ pub fn static_players_with_call_status() -> Vec<PlayerWithCallStatus> {
|
||||||
pub fn static_project_panel_project_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
|
pub fn static_project_panel_project_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
|
||||||
vec![
|
vec![
|
||||||
ListEntry::new(Label::new("zed"))
|
ListEntry::new(Label::new("zed"))
|
||||||
.left_icon(Icon::FolderOpen.into())
|
.set_left_icon(Icon::FolderOpen.into())
|
||||||
.indent_level(0)
|
.set_indent_level(0)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new(".cargo"))
|
ListEntry::new(Label::new(".cargo"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new(".config"))
|
ListEntry::new(Label::new(".config"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new(".git").color(LabelColor::Hidden))
|
ListEntry::new(Label::new(".git").color(LabelColor::Hidden))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new(".cargo"))
|
ListEntry::new(Label::new(".cargo"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new(".idea").color(LabelColor::Hidden))
|
ListEntry::new(Label::new(".idea").color(LabelColor::Hidden))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("assets"))
|
ListEntry::new(Label::new("assets"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(1)
|
.set_indent_level(1)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("cargo-target").color(LabelColor::Hidden))
|
ListEntry::new(Label::new("cargo-target").color(LabelColor::Hidden))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("crates"))
|
ListEntry::new(Label::new("crates"))
|
||||||
.left_icon(Icon::FolderOpen.into())
|
.set_left_icon(Icon::FolderOpen.into())
|
||||||
.indent_level(1)
|
.set_indent_level(1)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("activity_indicator"))
|
ListEntry::new(Label::new("activity_indicator"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("ai"))
|
ListEntry::new(Label::new("ai"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("audio"))
|
ListEntry::new(Label::new("audio"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("auto_update"))
|
ListEntry::new(Label::new("auto_update"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("breadcrumbs"))
|
ListEntry::new(Label::new("breadcrumbs"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("call"))
|
ListEntry::new(Label::new("call"))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("sqlez").color(LabelColor::Modified))
|
ListEntry::new(Label::new("sqlez").color(LabelColor::Modified))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(2)
|
.set_indent_level(2)
|
||||||
.set_toggle(ToggleState::NotToggled),
|
.set_toggle(ToggleState::NotToggled),
|
||||||
ListEntry::new(Label::new("gpui2"))
|
ListEntry::new(Label::new("gpui2"))
|
||||||
.left_icon(Icon::FolderOpen.into())
|
.set_left_icon(Icon::FolderOpen.into())
|
||||||
.indent_level(2)
|
.set_indent_level(2)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("src"))
|
ListEntry::new(Label::new("src"))
|
||||||
.left_icon(Icon::FolderOpen.into())
|
.set_left_icon(Icon::FolderOpen.into())
|
||||||
.indent_level(3)
|
.set_indent_level(3)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("derive_element.rs"))
|
ListEntry::new(Label::new("derive_element.rs"))
|
||||||
.left_icon(Icon::FileRust.into())
|
.set_left_icon(Icon::FileRust.into())
|
||||||
.indent_level(4),
|
.set_indent_level(4),
|
||||||
ListEntry::new(Label::new("storybook").color(LabelColor::Modified))
|
ListEntry::new(Label::new("storybook").color(LabelColor::Modified))
|
||||||
.left_icon(Icon::FolderOpen.into())
|
.set_left_icon(Icon::FolderOpen.into())
|
||||||
.indent_level(1)
|
.set_indent_level(1)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("docs").color(LabelColor::Default))
|
ListEntry::new(Label::new("docs").color(LabelColor::Default))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(2)
|
.set_indent_level(2)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("src").color(LabelColor::Modified))
|
ListEntry::new(Label::new("src").color(LabelColor::Modified))
|
||||||
.left_icon(Icon::FolderOpen.into())
|
.set_left_icon(Icon::FolderOpen.into())
|
||||||
.indent_level(3)
|
.set_indent_level(3)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("ui").color(LabelColor::Modified))
|
ListEntry::new(Label::new("ui").color(LabelColor::Modified))
|
||||||
.left_icon(Icon::FolderOpen.into())
|
.set_left_icon(Icon::FolderOpen.into())
|
||||||
.indent_level(4)
|
.set_indent_level(4)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("component").color(LabelColor::Created))
|
ListEntry::new(Label::new("component").color(LabelColor::Created))
|
||||||
.left_icon(Icon::FolderOpen.into())
|
.set_left_icon(Icon::FolderOpen.into())
|
||||||
.indent_level(5)
|
.set_indent_level(5)
|
||||||
.set_toggle(ToggleState::Toggled),
|
.set_toggle(ToggleState::Toggled),
|
||||||
ListEntry::new(Label::new("facepile.rs").color(LabelColor::Default))
|
ListEntry::new(Label::new("facepile.rs").color(LabelColor::Default))
|
||||||
.left_icon(Icon::FileRust.into())
|
.set_left_icon(Icon::FileRust.into())
|
||||||
.indent_level(6),
|
.set_indent_level(6),
|
||||||
ListEntry::new(Label::new("follow_group.rs").color(LabelColor::Default))
|
ListEntry::new(Label::new("follow_group.rs").color(LabelColor::Default))
|
||||||
.left_icon(Icon::FileRust.into())
|
.set_left_icon(Icon::FileRust.into())
|
||||||
.indent_level(6),
|
.set_indent_level(6),
|
||||||
ListEntry::new(Label::new("list_item.rs").color(LabelColor::Created))
|
ListEntry::new(Label::new("list_item.rs").color(LabelColor::Created))
|
||||||
.left_icon(Icon::FileRust.into())
|
.set_left_icon(Icon::FileRust.into())
|
||||||
.indent_level(6),
|
.set_indent_level(6),
|
||||||
ListEntry::new(Label::new("tab.rs").color(LabelColor::Default))
|
ListEntry::new(Label::new("tab.rs").color(LabelColor::Default))
|
||||||
.left_icon(Icon::FileRust.into())
|
.set_left_icon(Icon::FileRust.into())
|
||||||
.indent_level(6),
|
.set_indent_level(6),
|
||||||
ListEntry::new(Label::new("target").color(LabelColor::Hidden))
|
ListEntry::new(Label::new("target").color(LabelColor::Hidden))
|
||||||
.left_icon(Icon::Folder.into())
|
.set_left_icon(Icon::Folder.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new(".dockerignore"))
|
ListEntry::new(Label::new(".dockerignore"))
|
||||||
.left_icon(Icon::FileGeneric.into())
|
.set_left_icon(Icon::FileGeneric.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new(".DS_Store").color(LabelColor::Hidden))
|
ListEntry::new(Label::new(".DS_Store").color(LabelColor::Hidden))
|
||||||
.left_icon(Icon::FileGeneric.into())
|
.set_left_icon(Icon::FileGeneric.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("Cargo.lock"))
|
ListEntry::new(Label::new("Cargo.lock"))
|
||||||
.left_icon(Icon::FileLock.into())
|
.set_left_icon(Icon::FileLock.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("Cargo.toml"))
|
ListEntry::new(Label::new("Cargo.toml"))
|
||||||
.left_icon(Icon::FileToml.into())
|
.set_left_icon(Icon::FileToml.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("Dockerfile"))
|
ListEntry::new(Label::new("Dockerfile"))
|
||||||
.left_icon(Icon::FileGeneric.into())
|
.set_left_icon(Icon::FileGeneric.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("Procfile"))
|
ListEntry::new(Label::new("Procfile"))
|
||||||
.left_icon(Icon::FileGeneric.into())
|
.set_left_icon(Icon::FileGeneric.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("README.md"))
|
ListEntry::new(Label::new("README.md"))
|
||||||
.left_icon(Icon::FileDoc.into())
|
.set_left_icon(Icon::FileDoc.into())
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(From::from)
|
.map(From::from)
|
||||||
|
@ -451,14 +451,14 @@ pub fn static_project_panel_project_items<S: 'static + Send + Sync + Clone>() ->
|
||||||
pub fn static_project_panel_single_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
|
pub fn static_project_panel_single_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
|
||||||
vec![
|
vec![
|
||||||
ListEntry::new(Label::new("todo.md"))
|
ListEntry::new(Label::new("todo.md"))
|
||||||
.left_icon(Icon::FileDoc.into())
|
.set_left_icon(Icon::FileDoc.into())
|
||||||
.indent_level(0),
|
.set_indent_level(0),
|
||||||
ListEntry::new(Label::new("README.md"))
|
ListEntry::new(Label::new("README.md"))
|
||||||
.left_icon(Icon::FileDoc.into())
|
.set_left_icon(Icon::FileDoc.into())
|
||||||
.indent_level(0),
|
.set_indent_level(0),
|
||||||
ListEntry::new(Label::new("config.json"))
|
ListEntry::new(Label::new("config.json"))
|
||||||
.left_icon(Icon::FileGeneric.into())
|
.set_left_icon(Icon::FileGeneric.into())
|
||||||
.indent_level(0),
|
.set_indent_level(0),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(From::from)
|
.map(From::from)
|
||||||
|
@ -467,11 +467,11 @@ pub fn static_project_panel_single_items<S: 'static + Send + Sync + Clone>() ->
|
||||||
|
|
||||||
pub fn static_collab_panel_current_call<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
|
pub fn static_collab_panel_current_call<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
|
||||||
vec![
|
vec![
|
||||||
ListEntry::new(Label::new("as-cii")).left_avatar("http://github.com/as-cii.png?s=50"),
|
ListEntry::new(Label::new("as-cii")).set_left_avatar("http://github.com/as-cii.png?s=50"),
|
||||||
ListEntry::new(Label::new("nathansobo"))
|
ListEntry::new(Label::new("nathansobo"))
|
||||||
.left_avatar("http://github.com/nathansobo.png?s=50"),
|
.set_left_avatar("http://github.com/nathansobo.png?s=50"),
|
||||||
ListEntry::new(Label::new("maxbrunsfeld"))
|
ListEntry::new(Label::new("maxbrunsfeld"))
|
||||||
.left_avatar("http://github.com/maxbrunsfeld.png?s=50"),
|
.set_left_avatar("http://github.com/maxbrunsfeld.png?s=50"),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(From::from)
|
.map(From::from)
|
||||||
|
@ -481,61 +481,61 @@ pub fn static_collab_panel_current_call<S: 'static + Send + Sync + Clone>() -> V
|
||||||
pub fn static_collab_panel_channels<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
|
pub fn static_collab_panel_channels<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
|
||||||
vec![
|
vec![
|
||||||
ListEntry::new(Label::new("zed"))
|
ListEntry::new(Label::new("zed"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(0),
|
.set_indent_level(0),
|
||||||
ListEntry::new(Label::new("community"))
|
ListEntry::new(Label::new("community"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("dashboards"))
|
ListEntry::new(Label::new("dashboards"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("feedback"))
|
ListEntry::new(Label::new("feedback"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("teams-in-channels-alpha"))
|
ListEntry::new(Label::new("teams-in-channels-alpha"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("current-projects"))
|
ListEntry::new(Label::new("current-projects"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(1),
|
.set_indent_level(1),
|
||||||
ListEntry::new(Label::new("codegen"))
|
ListEntry::new(Label::new("codegen"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("gpui2"))
|
ListEntry::new(Label::new("gpui2"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("livestreaming"))
|
ListEntry::new(Label::new("livestreaming"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("open-source"))
|
ListEntry::new(Label::new("open-source"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("replace"))
|
ListEntry::new(Label::new("replace"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("semantic-index"))
|
ListEntry::new(Label::new("semantic-index"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("vim"))
|
ListEntry::new(Label::new("vim"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
ListEntry::new(Label::new("web-tech"))
|
ListEntry::new(Label::new("web-tech"))
|
||||||
.left_icon(Icon::Hash.into())
|
.set_left_icon(Icon::Hash.into())
|
||||||
.size(ListEntrySize::Medium)
|
.set_size(ListEntrySize::Medium)
|
||||||
.indent_level(2),
|
.set_indent_level(2),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(From::from)
|
.map(From::from)
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
use gpui3::{hsla, rems, AbsoluteLength, Hsla};
|
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
|
||||||
pub struct Token {
|
|
||||||
pub list_indent_depth: AbsoluteLength,
|
|
||||||
pub default_panel_size: AbsoluteLength,
|
|
||||||
pub state_hover_background: Hsla,
|
|
||||||
pub state_active_background: Hsla,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for Token {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
list_indent_depth: AbsoluteLength::Rems(rems(0.5)),
|
|
||||||
default_panel_size: AbsoluteLength::Rems(rems(16.)),
|
|
||||||
state_hover_background: hsla(0.0, 0.0, 0.0, 0.08),
|
|
||||||
state_active_background: hsla(0.0, 0.0, 0.0, 0.16),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn token() -> Token {
|
|
||||||
Token::default()
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue