ui: Remove ToolStrip
component (#24529)
This PR removes the `ToolStrip` component. Pulling this change out of https://github.com/zed-industries/zed/pull/24456. Release Notes: - N/A
This commit is contained in:
parent
065fdcb86b
commit
072d2b061a
5 changed files with 0 additions and 97 deletions
|
@ -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")]
|
||||
|
|
|
@ -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::*;
|
||||
|
|
|
@ -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")),
|
||||
),
|
||||
),
|
||||
)),
|
||||
)
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue