#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ComponentSize {
Xs,
Sm,
#[default]
Default,
Lg,
}
impl ComponentSize {
#[must_use]
pub fn metrics(self) -> (f32, f32, f32) {
match self {
Self::Xs => (24.0, 8.0, 12.0),
Self::Sm => (28.0, 10.0, 12.8),
Self::Default => (32.0, 10.0, 14.0),
Self::Lg => (36.0, 10.0, 14.0),
}
}
#[must_use]
pub fn metrics_for(self, spacing: &crate::responsive::Spacing) -> (f32, f32, f32) {
let (height, h_padding, font_size) = self.metrics();
if spacing.is_mobile() {
(
height + spacing.touch_height - Self::Default.metrics().0,
h_padding + spacing.touch_padding - 10.0,
font_size,
)
} else {
(height, h_padding, font_size)
}
}
}