Update path header style

Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
This commit is contained in:
Nate Butler 2023-12-01 15:53:17 -05:00
parent 89aa6a3726
commit c07455efa7

View file

@ -51,7 +51,9 @@ use std::{
}; };
use sum_tree::Bias; use sum_tree::Bias;
use theme::{ActiveTheme, PlayerColor}; use theme::{ActiveTheme, PlayerColor};
use ui::{h_stack, Disclosure, IconButton, IconSize, Label, Tooltip}; use ui::{
h_stack, ButtonLike, ButtonStyle, Disclosure, IconButton, IconElement, IconSize, Label, Tooltip,
};
use ui::{prelude::*, Icon}; use ui::{prelude::*, Icon};
use util::ResultExt; use util::ResultExt;
use workspace::item::Item; use workspace::item::Item;
@ -2235,6 +2237,7 @@ impl EditorElement {
let jump_position = language::ToPoint::to_point(&jump_anchor, buffer); let jump_position = language::ToPoint::to_point(&jump_anchor, buffer);
IconButton::new(block_id, Icon::ArrowUpRight) IconButton::new(block_id, Icon::ArrowUpRight)
.style(ButtonStyle::Subtle)
.on_click(cx.listener_for(&self.editor, move |editor, e, cx| { .on_click(cx.listener_for(&self.editor, move |editor, e, cx| {
editor.jump(jump_path.clone(), jump_position, jump_anchor, cx); editor.jump(jump_path.clone(), jump_position, jump_anchor, cx);
})) }))
@ -2253,8 +2256,11 @@ impl EditorElement {
.map(|p| SharedString::from(p.to_string_lossy().to_string() + "/")); .map(|p| SharedString::from(p.to_string_lossy().to_string() + "/"));
} }
div().id("path header block").size_full().p_1p5().child( let is_open = true;
div().id("path header container").size_full().p_1p5().child(
h_stack() h_stack()
.id("path header block")
.py_1p5() .py_1p5()
.pl_3() .pl_3()
.pr_2() .pr_2()
@ -2266,15 +2272,23 @@ impl EditorElement {
.justify_between() .justify_between()
.cursor_pointer() .cursor_pointer()
.hover(|style| style.bg(cx.theme().colors().element_hover)) .hover(|style| style.bg(cx.theme().colors().element_hover))
.on_click(cx.listener(|_editor, _event, _cx| {
// TODO: Implement collapsing path headers
todo!("Clicking path header")
}))
.child( .child(
h_stack() h_stack()
.gap_3() .gap_3()
// TODO: Add open/close state and toggle action // TODO: Add open/close state and toggle action
.child( .child(
div() div().border().border_color(gpui::red()).child(
.border() ButtonLike::new("path-header-disclosure-control")
.border_color(gpui::red()) .style(ButtonStyle::Subtle)
.child(Disclosure::new(true)), .child(IconElement::new(match is_open {
true => Icon::ChevronDown,
false => Icon::ChevronRight,
})),
),
) )
.child( .child(
h_stack() h_stack()