Merge branch 'main' into copilot2

This commit is contained in:
Piotr Osiewicz 2023-12-06 15:13:13 +01:00
commit 1f538c5fdd
100 changed files with 10636 additions and 3033 deletions

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,
@ -173,13 +184,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(14. / 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))