Add bottom margin to the outline view

Max Brunsfeld created

Change summary

crates/gpui/src/elements/container.rs |  5 ++++
crates/outline/src/outline.rs         | 30 +++++++++++-----------------
crates/zed/assets/themes/_base.toml   |  2 
3 files changed, 18 insertions(+), 19 deletions(-)

Detailed changes

crates/gpui/src/elements/container.rs 🔗

@@ -52,6 +52,11 @@ impl Container {
         self
     }
 
+    pub fn with_margin_bottom(mut self, margin: f32) -> Self {
+        self.style.margin.bottom = margin;
+        self
+    }
+
     pub fn with_margin_left(mut self, margin: f32) -> Self {
         self.style.margin.left = margin;
         self

crates/outline/src/outline.rs 🔗

@@ -84,27 +84,21 @@ impl View for OutlineView {
     fn render(&mut self, _: &mut RenderContext<Self>) -> ElementBox {
         let settings = self.settings.borrow();
 
-        Align::new(
-            ConstrainedBox::new(
-                Container::new(
-                    Flex::new(Axis::Vertical)
-                        .with_child(
-                            Container::new(ChildView::new(self.query_editor.id()).boxed())
-                                .with_style(settings.theme.selector.input_editor.container)
-                                .boxed(),
-                        )
-                        .with_child(Flexible::new(1.0, false, self.render_matches()).boxed())
-                        .boxed(),
-                )
-                .with_style(settings.theme.selector.container)
-                .boxed(),
+        Flex::new(Axis::Vertical)
+            .with_child(
+                Container::new(ChildView::new(self.query_editor.id()).boxed())
+                    .with_style(settings.theme.selector.input_editor.container)
+                    .boxed(),
             )
+            .with_child(Flexible::new(1.0, false, self.render_matches()).boxed())
+            .contained()
+            .with_style(settings.theme.selector.container)
+            .constrained()
             .with_max_width(800.0)
             .with_max_height(1200.0)
-            .boxed(),
-        )
-        .top()
-        .named("outline view")
+            .aligned()
+            .top()
+            .named("outline view")
     }
 
     fn on_focus(&mut self, cx: &mut ViewContext<Self>) {

crates/zed/assets/themes/_base.toml 🔗

@@ -211,7 +211,7 @@ text = { extends = "$text.0" }
 [selector]
 background = "$surface.0"
 padding = 8
-margin.top = 52
+margin = { top = 52, bottom = 52 }
 corner_radius = 6
 shadow = { offset = [0, 2], blur = 16, color = "$shadow.0" }
 border = { width = 1, color = "$border.0" }