forge
Explore
Log in

Don't you dare go Hollow

One floating surface (parts::surface: raise, thread border, shadow, occludes) behind popovers, panels, Ctrl+K and the stats sheet

Browse files at this commit

7b463bab0bfdd941ce94091eb296b61e477f6865Ahmet Kaan GümüşParent: d618582
  • refactor
    • one floating surface (parts::surface: raise, thread border, shadow, occludes) behind popovers, panels, Ctrl+K and the stats sheet
    • stats sheet no longer lets clicks through
Show full message
♻️ refactor: one floating surface (parts::surface: raise, thread border, shadow, occludes) behind popovers, panels, Ctrl+K and the stats sheet; stats sheet no longer lets clicks through
crates/client/src/gui/chat.rsmodified+1 -6
@@ -1449,7 +1449,7 @@ impl Yumush {
1449 .stats_at1449 .stats_at
1450 .filter(|_| self.chat.voice_community().is_some())?;1450 .filter(|_| self.chat.voice_community().is_some())?;
1451 Some(1451 Some(
1452- div()1452+ super::parts::surface(palette.tokens)
1453 .id("stats_sheet")1453 .id("stats_sheet")
1454 .absolute()1454 .absolute()
1455 .right(px(space::LG))1455 .right(px(space::LG))
@@ -1464,11 +1464,6 @@ impl Yumush {
1464 StatsAt::Header => space::XL,1464 StatsAt::Header => space::XL,
1465 StatsAt::Dock => space::LG,1465 StatsAt::Dock => space::LG,
1466 }))1466 }))
1467- .rounded(px(radius::LG))
1468- .border_1()
1469- .border_color(palette.border)
1470- .bg(palette.tokens.raise())
1471- .shadow_lg()
1472 .child(voice_stats::stats_panel(1467 .child(voice_stats::stats_panel(
1473 &self.chat.stats,1468 &self.chat.stats,
1474 &|id| self.chat.name_of(id),1469 &|id| self.chat.name_of(id),
crates/client/src/gui/jump.rsmodified+1 -7
@@ -504,17 +504,11 @@ impl Yumush {
504 .on_click(cx.listener(|this, _, window, cx| this.close_jump(window, cx))),504 .on_click(cx.listener(|this, _, window, cx| this.close_jump(window, cx))),
505 )505 )
506 .child(506 .child(
507- div()507+ super::parts::surface(t)
508 .w(px(size::SHEET + size::THUMB))508 .w(px(size::SHEET + size::THUMB))
509 .flex()509 .flex()
510 .flex_col()510 .flex_col()
511 .overflow_hidden()511 .overflow_hidden()
512- .bg(t.raise())
513- .rounded(px(radius::LG))
514- .border_1()
515- .border_color(t.thread())
516- .shadow_lg()
517- .occlude()
518 .capture_action(cx.listener(512 .capture_action(cx.listener(
519 |this, _: &gpui_kit::component::input::Escape, window, cx| {513 |this, _: &gpui_kit::component::input::Escape, window, cx| {
520 this.close_jump(window, cx);514 this.close_jump(window, cx);
crates/client/src/gui/parts.rsmodified+10 -2
@@ -334,13 +334,21 @@ pub fn chevron(
334 .on_click(move |_, window, cx| on_click(window, cx))334 .on_click(move |_, window, cx| on_click(window, cx))
335 }335 }
336 336
337-pub fn popover(t: Tokens) -> Div {337+pub fn surface(t: Tokens) -> Div {
338- column()338+ div()
339 .bg(t.raise())339 .bg(t.raise())
340 .rounded(px(radius::LG))340 .rounded(px(radius::LG))
341 .border_1()341 .border_1()
342 .border_color(t.thread())342 .border_color(t.thread())
343 .shadow_lg()343 .shadow_lg()
344+ .occlude()
345+}
346+
347+pub fn popover(t: Tokens) -> Div {
348+ surface(t)
349+ .flex()
350+ .flex_col()
351+ .min_w_0()
344 .px(px(space::XL - 4.))352 .px(px(space::XL - 4.))
345 .py(px(space::LG + 2.))353 .py(px(space::LG + 2.))
346 }354 }
crates/client/src/gui/widget.rsmodified+2 -2
@@ -10,7 +10,7 @@ use gpui_kit::{
10 10
11 use super::{11 use super::{
12 Palette, Tooltip as _, Yumush, clickable, notify_error,12 Palette, Tooltip as _, Yumush, clickable, notify_error,
13- style::{radius, size, space},13+ style::{size, space},
14 };14 };
15 15
16 pub(super) fn icon_button(16 pub(super) fn icon_button(
@@ -33,7 +33,7 @@ pub(super) fn icon_button(
33 }33 }
34 34
35 pub(super) fn panel(palette: Palette) -> Div {35 pub(super) fn panel(palette: Palette) -> Div {
36- div().rounded(px(radius::LG)).bg(palette.field)36+ super::parts::surface(palette.tokens)
37 }37 }
38 38
39 pub(super) fn field(palette: Palette, input: &Entity<InputState>) -> Div {39 pub(super) fn field(palette: Palette, input: &Entity<InputState>) -> Div {