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
|
@ -36,7 +36,6 @@ pub enum ComponentStory {
|
||||||
TabBar,
|
TabBar,
|
||||||
Text,
|
Text,
|
||||||
ToggleButton,
|
ToggleButton,
|
||||||
ToolStrip,
|
|
||||||
ViewportUnits,
|
ViewportUnits,
|
||||||
WithRemSize,
|
WithRemSize,
|
||||||
Vector,
|
Vector,
|
||||||
|
@ -73,7 +72,6 @@ impl ComponentStory {
|
||||||
Self::TabBar => cx.new(|_| ui::TabBarStory).into(),
|
Self::TabBar => cx.new(|_| ui::TabBarStory).into(),
|
||||||
Self::Text => TextStory::model(cx).into(),
|
Self::Text => TextStory::model(cx).into(),
|
||||||
Self::ToggleButton => cx.new(|_| ui::ToggleButtonStory).into(),
|
Self::ToggleButton => cx.new(|_| ui::ToggleButtonStory).into(),
|
||||||
Self::ToolStrip => cx.new(|_| ui::ToolStripStory).into(),
|
|
||||||
Self::ViewportUnits => cx.new(|_| crate::stories::ViewportUnitsStory).into(),
|
Self::ViewportUnits => cx.new(|_| crate::stories::ViewportUnitsStory).into(),
|
||||||
Self::WithRemSize => cx.new(|_| crate::stories::WithRemSizeStory).into(),
|
Self::WithRemSize => cx.new(|_| crate::stories::WithRemSizeStory).into(),
|
||||||
Self::Vector => cx.new(|_| ui::VectorStory).into(),
|
Self::Vector => cx.new(|_| ui::VectorStory).into(),
|
||||||
|
|
|
@ -29,7 +29,6 @@ mod tab;
|
||||||
mod tab_bar;
|
mod tab_bar;
|
||||||
mod table;
|
mod table;
|
||||||
mod toggle;
|
mod toggle;
|
||||||
mod tool_strip;
|
|
||||||
mod tooltip;
|
mod tooltip;
|
||||||
|
|
||||||
#[cfg(feature = "stories")]
|
#[cfg(feature = "stories")]
|
||||||
|
@ -66,7 +65,6 @@ pub use tab::*;
|
||||||
pub use tab_bar::*;
|
pub use tab_bar::*;
|
||||||
pub use table::*;
|
pub use table::*;
|
||||||
pub use toggle::*;
|
pub use toggle::*;
|
||||||
pub use tool_strip::*;
|
|
||||||
pub use tooltip::*;
|
pub use tooltip::*;
|
||||||
|
|
||||||
#[cfg(feature = "stories")]
|
#[cfg(feature = "stories")]
|
||||||
|
|
|
@ -15,7 +15,6 @@ mod list_item;
|
||||||
mod tab;
|
mod tab;
|
||||||
mod tab_bar;
|
mod tab_bar;
|
||||||
mod toggle_button;
|
mod toggle_button;
|
||||||
mod tool_strip;
|
|
||||||
|
|
||||||
pub use avatar::*;
|
pub use avatar::*;
|
||||||
pub use button::*;
|
pub use button::*;
|
||||||
|
@ -31,4 +30,3 @@ pub use list_item::*;
|
||||||
pub use tab::*;
|
pub use tab::*;
|
||||||
pub use tab_bar::*;
|
pub use tab_bar::*;
|
||||||
pub use toggle_button::*;
|
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