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

@ -30,7 +30,7 @@ use std::{
sync::Arc,
};
use theme::ThemeSettings;
use ui::{prelude::*, v_stack, ContextMenu, IconElement, KeyBinding, Label, ListItem};
use ui::{prelude::*, v_stack, ContextMenu, Icon, KeyBinding, Label, ListItem};
use unicase::UniCase;
use util::{maybe, ResultExt, TryFutureExt};
use workspace::{
@ -1403,7 +1403,7 @@ impl ProjectPanel {
.indent_step_size(px(settings.indent_size))
.selected(is_selected)
.child(if let Some(icon) = &icon {
div().child(IconElement::from_path(icon.to_string()).color(Color::Muted))
div().child(Icon::from_path(icon.to_string()).color(Color::Muted))
} else {
div().size(IconSize::default().rems()).invisible()
})
@ -1590,7 +1590,7 @@ impl Render for DraggedProjectEntryView {
.indent_level(self.details.depth)
.indent_step_size(px(settings.indent_size))
.child(if let Some(icon) = &self.details.icon {
div().child(IconElement::from_path(icon.to_string()))
div().child(Icon::from_path(icon.to_string()))
} else {
div()
})
@ -1640,8 +1640,8 @@ impl Panel for ProjectPanel {
cx.notify();
}
fn icon(&self, _: &WindowContext) -> Option<ui::Icon> {
Some(ui::Icon::FileTree)
fn icon(&self, _: &WindowContext) -> Option<ui::IconName> {
Some(ui::IconName::FileTree)
}
fn icon_tooltip(&self, _cx: &WindowContext) -> Option<&'static str> {