Seperate pane and panel styling

Mikayla Maki and max created

co-authored-by: max <max@zed.dev>

Change summary

crates/theme/src/theme.rs         |  3 +
crates/workspace/src/pane.rs      |  2 
crates/workspace/src/workspace.rs | 39 ++++++++++++++++++--------------
styles/src/styleTree/workspace.ts | 10 +++++--
4 files changed, 32 insertions(+), 22 deletions(-)

Detailed changes

crates/theme/src/theme.rs 🔗

@@ -89,7 +89,8 @@ pub struct Workspace {
     pub breadcrumbs: Interactive<ContainedText>,
     pub disconnected_overlay: ContainedText,
     pub modal: ContainerStyle,
-    pub zoomed_foreground: ContainerStyle,
+    pub zoomed_panel_foreground: ContainerStyle,
+    pub zoomed_pane_foreground: ContainerStyle,
     pub zoomed_background: ContainerStyle,
     pub notification: ContainerStyle,
     pub notifications: Notifications,

crates/workspace/src/pane.rs 🔗

@@ -2,7 +2,7 @@ mod dragged_item_receiver;
 
 use super::{ItemHandle, SplitDirection};
 use crate::{
-    item::WeakItemHandle, toolbar::Toolbar, AutosaveSetting, Item, NewFile, NewSearch, NewTerminal,
+    item::WeakItemHandle, toolbar::Toolbar, AutosaveSetting, Item, NewFile, NewSearch,
     ToggleZoom, Workspace, WorkspaceSettings, NewCenterTerminal,
 };
 use anyhow::Result;

crates/workspace/src/workspace.rs 🔗

@@ -3270,37 +3270,42 @@ impl View for Workspace {
                                         enum ZoomBackground {}
                                         let zoomed = zoomed.upgrade(cx)?;
 
-                                        let mut background_style =
-                                            theme.workspace.zoomed_background;
+                                        let mut foreground_style;
                                         match self.zoomed_position {
                                             Some(DockPosition::Left) => {
-                                                background_style.padding.left = 0.;
-                                                background_style.padding.top = 0.;
-                                                background_style.padding.bottom = 0.;
-                                                background_style.padding.right *= 1.;
+                                                foreground_style =
+                                                    theme.workspace.zoomed_panel_foreground;
+                                                foreground_style.margin.left = 0.;
+                                                foreground_style.margin.top = 0.;
+                                                foreground_style.margin.bottom = 0.;
                                             }
                                             Some(DockPosition::Right) => {
-                                                background_style.padding.right = 0.;
-                                                background_style.padding.top = 0.;
-                                                background_style.padding.bottom = 0.;
-                                                background_style.padding.left *= 1.;
+                                                foreground_style =
+                                                    theme.workspace.zoomed_panel_foreground;
+                                                foreground_style.margin.right = 0.;
+                                                foreground_style.margin.top = 0.;
+                                                foreground_style.margin.bottom = 0.;
                                             }
                                             Some(DockPosition::Bottom) => {
-                                                background_style.padding.left = 0.;
-                                                background_style.padding.right = 0.;
-                                                background_style.padding.bottom = 0.;
-                                                background_style.padding.top *= 1.;
+                                                foreground_style =
+                                                    theme.workspace.zoomed_panel_foreground;
+                                                foreground_style.margin.left = 0.;
+                                                foreground_style.margin.right = 0.;
+                                                foreground_style.margin.bottom = 0.;
+                                            }
+                                            None => {
+                                                foreground_style =
+                                                    theme.workspace.zoomed_pane_foreground;
                                             }
-                                            None => {}
                                         }
 
                                         Some(
                                             ChildView::new(&zoomed, cx)
                                                 .contained()
-                                                .with_style(theme.workspace.zoomed_foreground)
+                                                .with_style(foreground_style)
                                                 .aligned()
                                                 .contained()
-                                                .with_style(background_style)
+                                                .with_style(theme.workspace.zoomed_background)
                                                 .mouse::<ZoomBackground>(0)
                                                 .capture_all()
                                                 .on_down(

styles/src/styleTree/workspace.ts 🔗

@@ -119,14 +119,18 @@ export default function workspace(colorScheme: ColorScheme) {
             cursor: "Arrow",
         },
         zoomedBackground: {
-            padding: 10,
             cursor: "Arrow",
-            background: withOpacity(background(colorScheme.lowest), 0.5)
+            background: withOpacity(background(colorScheme.lowest), 0.85)
         },
-        zoomedForeground: {
+        zoomedPaneForeground: {
+            margin: 10,
             shadow: colorScheme.modalShadow,
             border: border(colorScheme.highest, { overlay: true }),
         },
+        zoomedPanelForeground: {
+            margin: 18,
+            border: border(colorScheme.highest, { overlay: true }),
+        },
         dock: {
             left: {
                 border: border(layer, { right: true }),