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

@ -17,7 +17,9 @@ use util::{paths, ResultExt};
use workspace::{
create_and_open_local_file,
item::ItemHandle,
ui::{popover_menu, ButtonCommon, Clickable, ContextMenu, Icon, IconButton, IconSize, Tooltip},
ui::{
popover_menu, ButtonCommon, Clickable, ContextMenu, IconButton, IconName, IconSize, Tooltip,
},
StatusItemView, Toast, Workspace,
};
use zed_actions::OpenBrowser;
@ -51,15 +53,15 @@ impl Render for CopilotButton {
.unwrap_or_else(|| all_language_settings.copilot_enabled(None, None));
let icon = match status {
Status::Error(_) => Icon::CopilotError,
Status::Error(_) => IconName::CopilotError,
Status::Authorized => {
if enabled {
Icon::Copilot
IconName::Copilot
} else {
Icon::CopilotDisabled
IconName::CopilotDisabled
}
}
_ => Icon::CopilotInit,
_ => IconName::CopilotInit,
};
if let Status::Error(e) = status {

View file

@ -4,7 +4,7 @@ use gpui::{
FocusableView, InteractiveElement, IntoElement, Model, ParentElement, Render, Styled,
Subscription, ViewContext,
};
use ui::{prelude::*, Button, Icon, Label};
use ui::{prelude::*, Button, IconName, Label};
use workspace::ModalView;
const COPILOT_SIGN_UP_URL: &'static str = "https://github.com/features/copilot";
@ -175,7 +175,7 @@ impl Render for CopilotCodeVerification {
.w_32()
.h_16()
.flex_none()
.path(Icon::ZedXCopilot.path())
.path(IconName::ZedXCopilot.path())
.text_color(cx.theme().colors().icon),
)
.child(prompt)