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::{
};
use language::Diagnostic;
use lsp::LanguageServerId;
use ui::{h_stack, prelude::*, Button, ButtonLike, Color, Icon, IconElement, Label, Tooltip};
use ui::{h_stack, prelude::*, Button, ButtonLike, Color, Icon, IconName, Label, Tooltip};
use workspace::{item::ItemHandle, StatusItemView, ToolbarItemEvent, Workspace};
use crate::{Deploy, ProjectDiagnosticsEditor};
@ -25,7 +25,7 @@ impl Render for DiagnosticIndicator {
let diagnostic_indicator = match (self.summary.error_count, self.summary.warning_count) {
(0, 0) => h_stack().map(|this| {
this.child(
IconElement::new(Icon::Check)
Icon::new(IconName::Check)
.size(IconSize::Small)
.color(Color::Default),
)
@ -33,7 +33,7 @@ impl Render for DiagnosticIndicator {
(0, warning_count) => h_stack()
.gap_1()
.child(
IconElement::new(Icon::ExclamationTriangle)
Icon::new(IconName::ExclamationTriangle)
.size(IconSize::Small)
.color(Color::Warning),
)
@ -41,7 +41,7 @@ impl Render for DiagnosticIndicator {
(error_count, 0) => h_stack()
.gap_1()
.child(
IconElement::new(Icon::XCircle)
Icon::new(IconName::XCircle)
.size(IconSize::Small)
.color(Color::Error),
)
@ -49,13 +49,13 @@ impl Render for DiagnosticIndicator {
(error_count, warning_count) => h_stack()
.gap_1()
.child(
IconElement::new(Icon::XCircle)
Icon::new(IconName::XCircle)
.size(IconSize::Small)
.color(Color::Error),
)
.child(Label::new(error_count.to_string()).size(LabelSize::Small))
.child(
IconElement::new(Icon::ExclamationTriangle)
Icon::new(IconName::ExclamationTriangle)
.size(IconSize::Small)
.color(Color::Warning),
)
@ -66,7 +66,7 @@ impl Render for DiagnosticIndicator {
Some(
h_stack()
.gap_2()
.child(IconElement::new(Icon::ArrowCircle).size(IconSize::Small))
.child(Icon::new(IconName::ArrowCircle).size(IconSize::Small))
.child(
Label::new("Checking…")
.size(LabelSize::Small)