Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Swap the parameters to `IconButton`
Marshall Bowers6a532af1fdc6
diff --git a/crates/ui2/src/components/assistant_panel.rs b/crates/ui2/src/components/assistant_panel.rsindex 5f38fefb34a..d5d22d819c8 100644--- a/crates/ui2/src/components/assistant_panel.rs+++ b/crates/ui2/src/components/assistant_panel.rs@@ -45,7 +45,7 @@ impl<S: 'static + Send + Sync> AssistantPanel<S> {.child(div().flex()- .child(IconButton::new(Icon::Menu, "menu"))+ .child(IconButton::new("menu", Icon::Menu)).child(Label::new("New Conversation")),).child(@@ -53,11 +53,11 @@ impl<S: 'static + Send + Sync> AssistantPanel<S> {.flex().items_center().gap_px()- .child(IconButton::new(Icon::SplitMessage, "split_message"))- .child(IconButton::new(Icon::Quote, "quote"))- .child(IconButton::new(Icon::MagicWand, "magic_wand"))- .child(IconButton::new(Icon::Plus, "plus"))- .child(IconButton::new(Icon::Maximize, "maximize")),+ .child(IconButton::new("split_message", Icon::SplitMessage))+ .child(IconButton::new("quote", Icon::Quote))+ .child(IconButton::new("magic_wand", Icon::MagicWand))+ .child(IconButton::new("plus", Icon::Plus))+ .child(IconButton::new("maximize", Icon::Maximize)),),)// Chat Bodydiff --git a/crates/ui2/src/components/buffer_search.rs b/crates/ui2/src/components/buffer_search.rsindex 8e1b9b3e979..bdb31b03695 100644--- a/crates/ui2/src/components/buffer_search.rs+++ b/crates/ui2/src/components/buffer_search.rs@@ -32,7 +32,7 @@ impl BufferSearch {h_stack().bg(color.toolbar).p_2().child(h_stack().child(Input::new("Search")).child(- IconButton::<Self>::new(Icon::Replace, "replace")+ IconButton::<Self>::new("replace", Icon::Replace).when(self.is_replace_open, |this| this.color(IconColor::Accent)).on_click(|buffer_search, cx| {buffer_search.toggle_replace(cx);diff --git a/crates/ui2/src/components/chat_panel.rs b/crates/ui2/src/components/chat_panel.rsindex fda07f4718a..7afccd6d9d5 100644--- a/crates/ui2/src/components/chat_panel.rs+++ b/crates/ui2/src/components/chat_panel.rs@@ -45,8 +45,8 @@ impl<S: 'static + Send + Sync> ChatPanel<S> {.flex().items_center().gap_px()- .child(IconButton::new(Icon::File, "file"))- .child(IconButton::new(Icon::AudioOn, "audio_on")),+ .child(IconButton::new("file", Icon::File))+ .child(IconButton::new("audio_on", Icon::AudioOn)),),).child(diff --git a/crates/ui2/src/components/editor_pane.rs b/crates/ui2/src/components/editor_pane.rsindex a1da0da258d..ebdcd4a8738 100644--- a/crates/ui2/src/components/editor_pane.rs+++ b/crates/ui2/src/components/editor_pane.rs@@ -61,15 +61,15 @@ impl EditorPane {Toolbar::new().left_item(Breadcrumb::new(self.path.clone(), self.symbols.clone())).right_items(vec![- IconButton::new(Icon::InlayHint, "toggle_inlay_hints"),- IconButton::<Self>::new(Icon::MagnifyingGlass, "buffer_search")+ IconButton::new("toggle_inlay_hints", Icon::InlayHint),+ IconButton::<Self>::new("buffer_search", Icon::MagnifyingGlass).when(self.is_buffer_search_open, |this| {this.color(IconColor::Accent)}).on_click(|editor, cx| {editor.toggle_buffer_search(cx);}),- IconButton::new(Icon::MagicWand, "inline_assist"),+ IconButton::new("inline_assist", Icon::MagicWand),]),).children(Some(self.buffer_search.clone()).filter(|_| self.is_buffer_search_open))diff --git a/crates/ui2/src/components/icon_button.rs b/crates/ui2/src/components/icon_button.rsindex a5edfc9c73f..bd5ad77437c 100644--- a/crates/ui2/src/components/icon_button.rs+++ b/crates/ui2/src/components/icon_button.rs@@ -28,7 +28,7 @@ pub struct IconButton<S: 'static + Send + Sync> {}impl<S: 'static + Send + Sync> IconButton<S> {- pub fn new(icon: Icon, id: impl Into<ElementId>) -> Self {+ pub fn new(id: impl Into<ElementId>, icon: Icon) -> Self {Self {state_type: PhantomData,id: id.into(),diff --git a/crates/ui2/src/components/multi_buffer.rs b/crates/ui2/src/components/multi_buffer.rsindex 0b47f2c3d88..bf8b6777cf7 100644--- a/crates/ui2/src/components/multi_buffer.rs+++ b/crates/ui2/src/components/multi_buffer.rs@@ -34,7 +34,7 @@ impl<S: 'static + Send + Sync + Clone> MultiBuffer<S> {.p_4().bg(color.editor_subheader).child(Label::new("main.rs"))- .child(IconButton::new(Icon::ArrowUpRight, "arrow_up_right")),+ .child(IconButton::new("arrow_up_right", Icon::ArrowUpRight)),).child(buffer)}))diff --git a/crates/ui2/src/components/status_bar.rs b/crates/ui2/src/components/status_bar.rsindex cfcfdf07001..8ebb8901f34 100644--- a/crates/ui2/src/components/status_bar.rs+++ b/crates/ui2/src/components/status_bar.rs@@ -113,7 +113,7 @@ impl StatusBar {.items_center().gap_1().child(- IconButton::<Workspace>::new(Icon::FileTree, "project_panel")+ IconButton::<Workspace>::new("project_panel", Icon::FileTree).when(workspace.is_project_panel_open(), |this| {this.color(IconColor::Accent)})@@ -122,7 +122,7 @@ impl StatusBar {}),).child(- IconButton::<Workspace>::new(Icon::Hash, "collab_panel")+ IconButton::<Workspace>::new("collab_panel", Icon::Hash).when(workspace.is_collab_panel_open(), |this| {this.color(IconColor::Accent)})@@ -131,7 +131,7 @@ impl StatusBar {}),).child(ToolDivider::new())- .child(IconButton::new(Icon::XCircle, "diagnostics"))+ .child(IconButton::new("diagnostics", Icon::XCircle))}fn right_tools(@@ -164,11 +164,11 @@ impl StatusBar {.items_center().gap_1().child(- IconButton::new(Icon::Copilot, "copilot")+ IconButton::new("copilot", Icon::Copilot).on_click(|_, _| println!("Copilot clicked.")),).child(- IconButton::new(Icon::Envelope, "envelope")+ IconButton::new("envelope", Icon::Envelope).on_click(|_, _| println!("Send Feedback clicked.")),),)@@ -179,7 +179,7 @@ impl StatusBar {.items_center().gap_1().child(- IconButton::<Workspace>::new(Icon::Terminal, "terminal")+ IconButton::<Workspace>::new("terminal", Icon::Terminal).when(workspace.is_terminal_open(), |this| {this.color(IconColor::Accent)})@@ -188,7 +188,7 @@ impl StatusBar {}),).child(- IconButton::<Workspace>::new(Icon::MessageBubbles, "chat_panel")+ IconButton::<Workspace>::new("chat_panel", Icon::MessageBubbles).when(workspace.is_chat_panel_open(), |this| {this.color(IconColor::Accent)})@@ -197,7 +197,7 @@ impl StatusBar {}),).child(- IconButton::<Workspace>::new(Icon::Ai, "assistant_panel")+ IconButton::<Workspace>::new("assistant_panel", Icon::Ai).when(workspace.is_assistant_panel_open(), |this| {this.color(IconColor::Accent)})diff --git a/crates/ui2/src/components/tab_bar.rs b/crates/ui2/src/components/tab_bar.rsindex 445f2d6deb7..c7fe1578f27 100644--- a/crates/ui2/src/components/tab_bar.rs+++ b/crates/ui2/src/components/tab_bar.rs@@ -51,11 +51,11 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {.items_center().gap_px().child(- IconButton::new(Icon::ArrowLeft, "arrow_left")+ IconButton::new("arrow_left", Icon::ArrowLeft).state(InteractionState::Enabled.if_enabled(can_navigate_back)),).child(- IconButton::new(Icon::ArrowRight, "arrow_right").state(+ IconButton::new("arrow_right", Icon::ArrowRight).state(InteractionState::Enabled.if_enabled(can_navigate_forward),),),@@ -83,8 +83,8 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {.flex().items_center().gap_px()- .child(IconButton::new(Icon::Plus, "plus"))- .child(IconButton::new(Icon::Split, "split")),+ .child(IconButton::new("plus", Icon::Plus))+ .child(IconButton::new("split", Icon::Split)),),)}diff --git a/crates/ui2/src/components/terminal.rs b/crates/ui2/src/components/terminal.rsindex aaf4382f516..443973a0dce 100644--- a/crates/ui2/src/components/terminal.rs+++ b/crates/ui2/src/components/terminal.rs@@ -40,11 +40,11 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {.items_center().gap_px().child(- IconButton::new(Icon::ArrowLeft, "arrow_left").state(+ IconButton::new("arrow_left", Icon::ArrowLeft).state(InteractionState::Enabled.if_enabled(can_navigate_back),),)- .child(IconButton::new(Icon::ArrowRight, "arrow_right").state(+ .child(IconButton::new("arrow_right", Icon::ArrowRight).state(InteractionState::Enabled.if_enabled(can_navigate_forward),)),),diff --git a/crates/ui2/src/components/title_bar.rs b/crates/ui2/src/components/title_bar.rsindex c33d37238a3..f6d4fca97c2 100644--- a/crates/ui2/src/components/title_bar.rs+++ b/crates/ui2/src/components/title_bar.rs@@ -129,7 +129,7 @@ impl TitleBar {.child(Button::new("nate/gpui2-ui-components")),).children(player_list.map(|p| PlayerStack::new(p)))- .child(IconButton::new(Icon::Plus, "plus")),+ .child(IconButton::new("plus", Icon::Plus)),).child(div()@@ -141,8 +141,8 @@ impl TitleBar {.flex().items_center().gap_1()- .child(IconButton::new(Icon::FolderX, "folder_x"))- .child(IconButton::new(Icon::Exit, "exit")),+ .child(IconButton::new("folder_x", Icon::FolderX))+ .child(IconButton::new("exit", Icon::Exit)),).child(ToolDivider::new()).child(@@ -152,17 +152,17 @@ impl TitleBar {.items_center().gap_1().child(- IconButton::<TitleBar>::new(Icon::Mic, "toggle_mic_status")+ IconButton::<TitleBar>::new("toggle_mic_status", Icon::Mic).when(self.is_mic_muted(), |this| this.color(IconColor::Error)).on_click(|title_bar, cx| title_bar.toggle_mic_status(cx)),).child(- IconButton::<TitleBar>::new(Icon::AudioOn, "toggle_deafened")+ IconButton::<TitleBar>::new("toggle_deafened", Icon::AudioOn).when(self.is_deafened, |this| this.color(IconColor::Error)).on_click(|title_bar, cx| title_bar.toggle_deafened(cx)),).child(- IconButton::<TitleBar>::new(Icon::Screen, "toggle_screen_share")+ IconButton::<TitleBar>::new("toggle_screen_share", Icon::Screen).when(self.screen_share_status == ScreenShareStatus::Shared,|this| this.color(IconColor::Accent),diff --git a/crates/ui2/src/components/toolbar.rs b/crates/ui2/src/components/toolbar.rsindex 081c3664be2..0d44235fafe 100644--- a/crates/ui2/src/components/toolbar.rs+++ b/crates/ui2/src/components/toolbar.rs@@ -130,9 +130,9 @@ mod stories {],)).right_items(vec![- IconButton::new(Icon::InlayHint, "toggle_inlay_hints"),- IconButton::new(Icon::MagnifyingGlass, "buffer_search"),- IconButton::new(Icon::MagicWand, "inline_assist"),+ IconButton::new("toggle_inlay_hints", Icon::InlayHint),+ IconButton::new("buffer_search", Icon::MagnifyingGlass),+ IconButton::new("inline_assist", Icon::MagicWand),]),)}