Use IconElement in project panel

This commit is contained in:
Marshall Bowers 2023-11-14 15:44:26 -05:00
parent dcdbf43af0
commit 22f024bd5f
2 changed files with 14 additions and 13 deletions

View file

@ -129,7 +129,7 @@ impl Icon {
#[derive(Component)]
pub struct IconElement {
icon: Icon,
path: SharedString,
color: TextColor,
size: IconSize,
}
@ -137,7 +137,15 @@ pub struct IconElement {
impl IconElement {
pub fn new(icon: Icon) -> Self {
Self {
icon,
path: icon.path().into(),
color: TextColor::default(),
size: IconSize::default(),
}
}
pub fn from_path(path: impl Into<SharedString>) -> Self {
Self {
path: path.into(),
color: TextColor::default(),
size: IconSize::default(),
}
@ -162,7 +170,7 @@ impl IconElement {
svg()
.size(svg_size)
.flex_none()
.path(self.icon.path())
.path(self.path)
.text_color(self.color.color(cx))
}
}