#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Breakpoint {
Mobile,
#[default]
Desktop,
}
impl Breakpoint {
pub const MOBILE_MAX_WIDTH: f32 = 800.0;
#[must_use]
pub fn from_width(width: f32) -> Self {
if width < Self::MOBILE_MAX_WIDTH {
Self::Mobile
} else {
Self::Desktop
}
}
#[must_use]
pub fn is_mobile(self) -> bool {
self == Self::Mobile
}
#[must_use]
pub fn is_desktop(self) -> bool {
self == Self::Desktop
}
}