From cc0f936348f973ec9babd793fefd84c8bbf5f1aa Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 28 Oct 2025 10:54:41 +0800 Subject: [PATCH] tiles: Add `tile_radius` theme option and default 0px. (#1441) --- crates/story/examples/tiles.rs | 8 ++++---- crates/ui/src/dock/tiles.rs | 2 +- crates/ui/src/theme/mod.rs | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/story/examples/tiles.rs b/crates/story/examples/tiles.rs index d77f7d3e..12f1b7e2 100644 --- a/crates/story/examples/tiles.rs +++ b/crates/story/examples/tiles.rs @@ -1,12 +1,12 @@ use anyhow::{Context as _, Result}; use gpui::*; use gpui_component::{ + ActiveTheme, Root, Sizable, TitleBar, dock::{ - register_panel, DockArea, DockAreaState, DockEvent, DockItem, Panel, PanelEvent, PanelInfo, - PanelRegistry, PanelState, PanelView, + DockArea, DockAreaState, DockEvent, DockItem, Panel, PanelEvent, PanelInfo, PanelRegistry, + PanelState, PanelView, register_panel, }, input::{InputState, TextInput}, - ActiveTheme, Root, Sizable, TitleBar, }; use serde::{Deserialize, Serialize}; use std::{sync::Arc, time::Duration}; @@ -100,7 +100,7 @@ impl Panel for ContainerPanel { Some( div() .w_24() - .h_5() + .h_6() .px_0p5() .rounded_lg() .border_1() diff --git a/crates/ui/src/dock/tiles.rs b/crates/ui/src/dock/tiles.rs index 51fc5930..124f7e7f 100644 --- a/crates/ui/src/dock/tiles.rs +++ b/crates/ui/src/dock/tiles.rs @@ -890,7 +890,7 @@ impl Tiles { // More 1px to account for the border width when 2 panels are too close .w(item.bounds.size.width + px(1.)) .h(item.bounds.size.height + px(1.)) - .rounded(cx.theme().radius) + .rounded(cx.theme().tile_radius) .child(h_flex().overflow_hidden().size_full().child(panel_view)) .children(self.render_resize_handles(window, cx, entity_id, &item)) .child(self.render_drag_bar(window, cx, entity_id, &item)) diff --git a/crates/ui/src/theme/mod.rs b/crates/ui/src/theme/mod.rs index 62c70491..974f44dd 100644 --- a/crates/ui/src/theme/mod.rs +++ b/crates/ui/src/theme/mod.rs @@ -58,6 +58,8 @@ pub struct Theme { pub tile_grid_size: Pixels, /// The shadow of the tile panel. pub tile_shadow: bool, + /// The border radius of the tile panel, default is 0px. + pub tile_radius: Pixels, } impl Default for Theme { @@ -198,6 +200,7 @@ impl From for Theme { scrollbar_show: ScrollbarShow::default(), tile_grid_size: px(8.), tile_shadow: true, + tile_radius: px(0.), colors, light_theme: Rc::new(ThemeConfig::default()), dark_theme: Rc::new(ThemeConfig::default()),