#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[non_exhaustive]
pub enum IllustrationVariant {
#[default]
Empty,
Success,
Error,
Offline,
}
impl IllustrationVariant {
pub fn as_str(self) -> &'static str {
match self {
Self::Empty => "empty",
Self::Success => "success",
Self::Error => "error",
Self::Offline => "offline",
}
}
pub(crate) fn shapes(self) -> &'static [IllustrationShape] {
match self {
Self::Empty => &[
IllustrationShape::Polygon(&[32.0, 48.0, 88.0, 48.0, 81.0, 83.0, 39.0, 83.0]),
IllustrationShape::Polyline(&[43.0, 48.0, 49.0, 36.0, 71.0, 36.0, 77.0, 48.0]),
IllustrationShape::Line(&[47.0, 66.0, 73.0, 66.0]),
],
Self::Success => &[
IllustrationShape::Circle { cx: 60.0, cy: 60.0, r: 28.0 },
IllustrationShape::Polyline(&[45.0, 60.0, 55.0, 70.0, 76.0, 47.0]),
],
Self::Error => &[
IllustrationShape::Circle { cx: 60.0, cy: 60.0, r: 28.0 },
IllustrationShape::Line(&[49.0, 49.0, 71.0, 71.0]),
IllustrationShape::Line(&[71.0, 49.0, 49.0, 71.0]),
],
Self::Offline => &[
IllustrationShape::RoundedRect { x: 24.0, y: 45.0, width: 72.0, height: 35.0, radius: 18.0 },
IllustrationShape::Line(&[30.0, 30.0, 90.0, 90.0]),
],
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub(crate) enum IllustrationShape {
Circle { cx: f64, cy: f64, r: f64 },
RoundedRect { x: f64, y: f64, width: f64, height: f64, radius: f64 },
Line(&'static [f64]),
Polygon(&'static [f64]),
Polyline(&'static [f64]),
}