Add dock borders

This commit is contained in:
Nate Butler 2023-11-16 16:17:17 -05:00
parent 9c5f580012
commit 3223e21d9f

View file

@ -7,6 +7,7 @@ use gpui::{
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::sync::Arc; use std::sync::Arc;
use theme2::ActiveTheme;
use ui::{h_stack, IconButton, InteractionState, Tooltip}; use ui::{h_stack, IconButton, InteractionState, Tooltip};
pub enum PanelEvent { pub enum PanelEvent {
@ -443,10 +444,16 @@ impl Render for Dock {
let size = entry.panel.size(cx); let size = entry.panel.size(cx);
div() div()
.border_color(cx.theme().colors().border)
.map(|this| match self.position().axis() { .map(|this| match self.position().axis() {
Axis::Horizontal => this.w(px(size)).h_full(), Axis::Horizontal => this.w(px(size)).h_full(),
Axis::Vertical => this.h(px(size)).w_full(), Axis::Vertical => this.h(px(size)).w_full(),
}) })
.map(|this| match self.position() {
DockPosition::Left => this.border_r(),
DockPosition::Right => this.border_l(),
DockPosition::Bottom => this.border_t(),
})
.child(entry.panel.to_any()) .child(entry.panel.to_any())
} else { } else {
div() div()
@ -675,7 +682,7 @@ impl Render for PanelButtons {
Some(button) Some(button)
}); });
h_stack().children(buttons) h_stack().gap_0p5().children(buttons)
} }
} }