use super::breakpoint::Breakpoint;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Spacing {
pub breakpoint: Breakpoint,
pub touch_height: f32,
pub touch_padding: f32,
pub gap: f32,
pub page_padding: f32,
pub content_max_width: f32,
}
impl Spacing {
#[must_use]
pub fn desktop() -> Self {
Self {
breakpoint: Breakpoint::Desktop,
touch_height: 32.0,
touch_padding: 10.0,
gap: 8.0,
page_padding: 32.0,
content_max_width: 1440.0,
}
}
#[must_use]
pub fn mobile() -> Self {
Self {
breakpoint: Breakpoint::Mobile,
touch_height: 44.0,
touch_padding: 14.0,
gap: 12.0,
page_padding: 16.0,
content_max_width: 1440.0,
}
}
#[must_use]
pub fn for_breakpoint(breakpoint: Breakpoint) -> Self {
match breakpoint {
Breakpoint::Mobile => Self::mobile(),
Breakpoint::Desktop => Self::desktop(),
}
}
#[must_use]
pub fn is_mobile(self) -> bool {
self.breakpoint.is_mobile()
}
}