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
45 changed files with 364 additions and 360 deletions
+6 -6
View File
@@ -19,7 +19,7 @@ use workspace::{
dock::{DockPosition, Panel, PanelEvent},
item::Item,
pane,
ui::Icon,
ui::IconName,
DraggedTab, Pane, Workspace,
};
@@ -71,7 +71,7 @@ impl TerminalPanel {
h_stack()
.gap_2()
.child(
IconButton::new("plus", Icon::Plus)
IconButton::new("plus", IconName::Plus)
.icon_size(IconSize::Small)
.on_click(move |_, cx| {
terminal_panel
@@ -82,10 +82,10 @@ impl TerminalPanel {
)
.child({
let zoomed = pane.is_zoomed();
IconButton::new("toggle_zoom", Icon::Maximize)
IconButton::new("toggle_zoom", IconName::Maximize)
.icon_size(IconSize::Small)
.selected(zoomed)
.selected_icon(Icon::Minimize)
.selected_icon(IconName::Minimize)
.on_click(cx.listener(|pane, _, cx| {
pane.toggle_zoom(&workspace::ToggleZoom, cx);
}))
@@ -477,8 +477,8 @@ impl Panel for TerminalPanel {
"TerminalPanel"
}
fn icon(&self, _cx: &WindowContext) -> Option<Icon> {
Some(Icon::Terminal)
fn icon(&self, _cx: &WindowContext) -> Option<IconName> {
Some(IconName::Terminal)
}
fn icon_tooltip(&self, _cx: &WindowContext) -> Option<&'static str> {
+2 -2
View File
@@ -20,7 +20,7 @@ use terminal::{
Clear, Copy, Event, MaybeNavigationTarget, Paste, ShowCharacterPalette, Terminal,
};
use terminal_element::TerminalElement;
use ui::{h_stack, prelude::*, ContextMenu, Icon, IconElement, Label};
use ui::{h_stack, prelude::*, ContextMenu, Icon, IconName, Label};
use util::{paths::PathLikeWithPosition, ResultExt};
use workspace::{
item::{BreadcrumbText, Item, ItemEvent},
@@ -690,7 +690,7 @@ impl Item for TerminalView {
let title = self.terminal().read(cx).title(true);
h_stack()
.gap_2()
.child(IconElement::new(Icon::Terminal))
.child(Icon::new(IconName::Terminal))
.child(Label::new(title).color(if selected {
Color::Default
} else {