ui: Remove `ToolStrip` component (#24529)

Marshall Bowers created

This PR removes the `ToolStrip` component.

Pulling this change out of
https://github.com/zed-industries/zed/pull/24456.

Release Notes:

- N/A

Change summary

crates/storybook/src/story_selector.rs         |  2 
crates/ui/src/components.rs                    |  2 
crates/ui/src/components/stories.rs            |  2 
crates/ui/src/components/stories/tool_strip.rs | 33 -----------
crates/ui/src/components/tool_strip.rs         | 58 --------------------
5 files changed, 97 deletions(-)

Detailed changes

crates/storybook/src/story_selector.rs 🔗

@@ -36,7 +36,6 @@ pub enum ComponentStory {
     TabBar,
     Text,
     ToggleButton,
-    ToolStrip,
     ViewportUnits,
     WithRemSize,
     Vector,
@@ -73,7 +72,6 @@ impl ComponentStory {
             Self::TabBar => cx.new(|_| ui::TabBarStory).into(),
             Self::Text => TextStory::model(cx).into(),
             Self::ToggleButton => cx.new(|_| ui::ToggleButtonStory).into(),
-            Self::ToolStrip => cx.new(|_| ui::ToolStripStory).into(),
             Self::ViewportUnits => cx.new(|_| crate::stories::ViewportUnitsStory).into(),
             Self::WithRemSize => cx.new(|_| crate::stories::WithRemSizeStory).into(),
             Self::Vector => cx.new(|_| ui::VectorStory).into(),

crates/ui/src/components.rs 🔗

@@ -29,7 +29,6 @@ mod tab;
 mod tab_bar;
 mod table;
 mod toggle;
-mod tool_strip;
 mod tooltip;
 
 #[cfg(feature = "stories")]
@@ -66,7 +65,6 @@ pub use tab::*;
 pub use tab_bar::*;
 pub use table::*;
 pub use toggle::*;
-pub use tool_strip::*;
 pub use tooltip::*;
 
 #[cfg(feature = "stories")]

crates/ui/src/components/stories.rs 🔗

@@ -15,7 +15,6 @@ mod list_item;
 mod tab;
 mod tab_bar;
 mod toggle_button;
-mod tool_strip;
 
 pub use avatar::*;
 pub use button::*;
@@ -31,4 +30,3 @@ pub use list_item::*;
 pub use tab::*;
 pub use tab_bar::*;
 pub use toggle_button::*;
-pub use tool_strip::*;

crates/ui/src/components/stories/tool_strip.rs 🔗

@@ -1,33 +0,0 @@
-use gpui::Render;
-use story::{Story, StoryItem, StorySection};
-
-use crate::{prelude::*, ToolStrip, Tooltip};
-
-pub struct ToolStripStory;
-
-impl Render for ToolStripStory {
-    fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
-        Story::container()
-            .child(Story::title_for::<ToolStrip>())
-            .child(
-                StorySection::new().child(StoryItem::new(
-                    "Vertical Tool Strip",
-                    h_flex().child(
-                        ToolStrip::vertical("tool_strip_example")
-                            .tool(
-                                IconButton::new("example_tool", IconName::AudioOn)
-                                    .tooltip(Tooltip::text("Example tool")),
-                            )
-                            .tool(
-                                IconButton::new("example_tool_2", IconName::MicMute)
-                                    .tooltip(Tooltip::text("Example tool 2")),
-                            )
-                            .tool(
-                                IconButton::new("example_tool_3", IconName::Screen)
-                                    .tooltip(Tooltip::text("Example tool 3")),
-                            ),
-                    ),
-                )),
-            )
-    }
-}

crates/ui/src/components/tool_strip.rs 🔗

@@ -1,58 +0,0 @@
-#![allow(missing_docs)]
-
-use gpui::Axis;
-
-use crate::prelude::*;
-
-#[derive(IntoElement)]
-pub struct ToolStrip {
-    id: ElementId,
-    tools: Vec<IconButton>,
-    axis: Axis,
-}
-
-impl ToolStrip {
-    fn new(id: ElementId, axis: Axis) -> Self {
-        Self {
-            id,
-            tools: vec![],
-            axis,
-        }
-    }
-
-    pub fn vertical(id: impl Into<ElementId>) -> Self {
-        Self::new(id.into(), Axis::Vertical)
-    }
-
-    pub fn tools(mut self, tools: Vec<IconButton>) -> Self {
-        self.tools = tools;
-        self
-    }
-
-    pub fn tool(mut self, tool: IconButton) -> Self {
-        self.tools.push(tool);
-        self
-    }
-}
-
-impl RenderOnce for ToolStrip {
-    fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
-        let group = format!("tool_strip_{}", self.id.clone());
-
-        div()
-            .id(self.id.clone())
-            .group(group)
-            .map(|element| match self.axis {
-                Axis::Vertical => element.v_flex(),
-                Axis::Horizontal => element.h_flex(),
-            })
-            .flex_none()
-            .gap(DynamicSpacing::Base04.rems(cx))
-            .p(DynamicSpacing::Base02.rems(cx))
-            .border_1()
-            .border_color(cx.theme().colors().border)
-            .rounded(rems_from_px(6.0))
-            .bg(cx.theme().colors().elevated_surface_background)
-            .children(self.tools)
-    }
-}