Rename IconElement to just Icon (#3974)

This PR renames the `IconElement` component to just `Icon`.

This better matches the rest of our components, as `IconElement` was the
only one using this naming convention.

The `Icon` enum has been renamed to `IconName` to free up the name.

I was trying to come up with a way that would allow rendering an
`Icon::Zed` directly (and thus make the `IconElement` a hidden part of
the API), but I couldn't come up with a way to do this cleanly.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-01-09 10:11:20 -05:00 committed by GitHub
parent 29ed067b26
commit fa53353c57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 364 additions and 360 deletions

View file

@ -6,7 +6,7 @@ use gpui::{
Subscription, View, ViewContext, WeakView,
};
use search::{buffer_search, BufferSearchBar};
use ui::{prelude::*, ButtonSize, ButtonStyle, Icon, IconButton, IconSize, Tooltip};
use ui::{prelude::*, ButtonSize, ButtonStyle, IconButton, IconName, IconSize, Tooltip};
use workspace::{
item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace,
};
@ -43,7 +43,7 @@ impl Render for QuickActionBar {
let inlay_hints_button = Some(QuickActionBarButton::new(
"toggle inlay hints",
Icon::InlayHint,
IconName::InlayHint,
editor.read(cx).inlay_hints_enabled(),
Box::new(editor::ToggleInlayHints),
"Toggle Inlay Hints",
@ -60,7 +60,7 @@ impl Render for QuickActionBar {
let search_button = Some(QuickActionBarButton::new(
"toggle buffer search",
Icon::MagnifyingGlass,
IconName::MagnifyingGlass,
!self.buffer_search_bar.read(cx).is_dismissed(),
Box::new(buffer_search::Deploy { focus: false }),
"Buffer Search",
@ -77,7 +77,7 @@ impl Render for QuickActionBar {
let assistant_button = QuickActionBarButton::new(
"toggle inline assistant",
Icon::MagicWand,
IconName::MagicWand,
false,
Box::new(InlineAssist),
"Inline Assist",
@ -107,7 +107,7 @@ impl EventEmitter<ToolbarItemEvent> for QuickActionBar {}
#[derive(IntoElement)]
struct QuickActionBarButton {
id: ElementId,
icon: Icon,
icon: IconName,
toggled: bool,
action: Box<dyn Action>,
tooltip: SharedString,
@ -117,7 +117,7 @@ struct QuickActionBarButton {
impl QuickActionBarButton {
fn new(
id: impl Into<ElementId>,
icon: Icon,
icon: IconName,
toggled: bool,
action: Box<dyn Action>,
tooltip: impl Into<SharedString>,