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
@@ -1,10 +1,10 @@
use crate::prelude::*;
use crate::{h_stack, Icon, IconElement, IconSize, Label};
use crate::{h_stack, Icon, IconName, IconSize, Label};
#[derive(IntoElement)]
pub struct ListSubHeader {
label: SharedString,
start_slot: Option<Icon>,
start_slot: Option<IconName>,
inset: bool,
}
@@ -17,7 +17,7 @@ impl ListSubHeader {
}
}
pub fn left_icon(mut self, left_icon: Option<Icon>) -> Self {
pub fn left_icon(mut self, left_icon: Option<IconName>) -> Self {
self.start_slot = left_icon;
self
}
@@ -40,11 +40,10 @@ impl RenderOnce for ListSubHeader {
.flex()
.gap_1()
.items_center()
.children(self.start_slot.map(|i| {
IconElement::new(i)
.color(Color::Muted)
.size(IconSize::Small)
}))
.children(
self.start_slot
.map(|i| Icon::new(i).color(Color::Muted).size(IconSize::Small)),
)
.child(Label::new(self.label.clone()).color(Color::Muted)),
),
)