Update icon size

This commit is contained in:
Nate Butler 2023-12-05 09:10:16 -05:00
parent af72772a72
commit f9efaebddf

View file

@ -1,15 +1,26 @@
use gpui::{rems, svg, IntoElement, Svg};
use gpui::{rems, svg, IntoElement, Rems, Svg};
use strum::EnumIter;
use crate::prelude::*;
#[derive(Default, PartialEq, Copy, Clone)]
pub enum IconSize {
XSmall,
Small,
#[default]
Medium,
}
impl IconSize {
pub fn rems(self) -> Rems {
match self {
IconSize::XSmall => rems(12. / 16.),
IconSize::Small => rems(14. / 16.),
IconSize::Medium => rems(16. / 16.),
}
}
}
#[derive(Debug, PartialEq, Copy, Clone, EnumIter)]
pub enum Icon {
Ai,
@ -170,13 +181,8 @@ impl RenderOnce for IconElement {
type Rendered = Svg;
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
let svg_size = match self.size {
IconSize::Small => rems(12. / 16.),
IconSize::Medium => rems(16. / 16.),
};
svg()
.size(svg_size)
.size(self.size.rems())
.flex_none()
.path(self.path)
.text_color(self.color.color(cx))