1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
#![allow(non_snake_case)]
use crate::views::Spacer;
pub mod spacing {
/// The amount of space taken up by a [`spacer::XXS()`]
///
/// [`spacer::XXS()`]: super::XXS
pub const XXS: f32 = 2.0;
/// The amount of space taken up by a [`spacer::XS()`]
///
/// [`spacer::XS()`]: super::XS
pub const XS: f32 = 4.0;
/// The amount of space taken up by a [`spacer::S()`]
///
/// [`spacer::S()`]: super::S
pub const S: f32 = 8.0;
/// The amount of space taken up by a [`spacer::M()`]
/// - A good minimum target size for trackpads/mice
///
/// [`spacer::M()`]: super::M
pub const M: f32 = 18.0; // tableview row height (after the dividing line)
/// The amount of space taken up by a [`spacer::L()`]
/// - A good minimum target height for “[a sentence or block of text][WCAG]”
///
/// [`spacer::L()`]: super::L
/// [WCAG]: https://www.smashingmagazine.com/2023/04/accessible-tap-target-sizes-rage-taps-clicks/#not-all-pixels-are-the-same
pub const L: f32 = 28.0;
/// The amount of space taken up by a [`spacer::XL()`]
///
/// [`spacer::XL()`]: super::XL
pub const XL: f32 = 38.0; // medium toolbar height (before the dividing line)
/// The amount of space taken up by a [`spacer::XXL()`]
/// - A good minimum target size for tablets/phones/touchscreen
///
/// [`spacer::XXL()`]: super::XXL
pub const XXL: f32 = 48.0; // phone tab bar height (before the (invisible) dividing line)
/// The amount of space taken up by a [`spacer::XXXL()`]
// - A good minimum target size for VR elements
///
/// [`spacer::XXXL()`]: super::XXXL
pub const XXXL: f32 = 58.0;
}
#[inline(always)]
pub fn fill() -> Spacer {
Spacer::fill()
}
#[inline(always)]
pub fn fixed(width: f32, height: f32) -> Spacer {
Spacer::fixed(width, height)
}
#[inline(always)]
pub fn width(width: f32) -> Spacer {
Spacer::width(width)
}
#[inline(always)]
pub fn height(height: f32) -> Spacer {
Spacer::height(height)
}
#[inline(always)]
pub fn empty() -> Spacer {
Spacer::empty()
}
#[inline(always)]
#[allow(clippy::should_implement_trait)]
pub fn default() -> Spacer {
S()
}
#[inline(always)]
pub fn XXS() -> Spacer {
fixed(spacing::XXS, spacing::XXS)
}
#[inline(always)]
pub fn XS() -> Spacer {
fixed(spacing::XS, spacing::XS)
}
#[inline(always)]
pub fn S() -> Spacer {
fixed(spacing::S, spacing::S)
}
#[inline(always)]
pub fn M() -> Spacer {
fixed(spacing::M, spacing::M)
}
#[inline(always)]
pub fn L() -> Spacer {
fixed(spacing::L, spacing::L)
}
#[inline(always)]
pub fn XL() -> Spacer {
fixed(spacing::XL, spacing::XL)
}
#[inline(always)]
pub fn XXL() -> Spacer {
fixed(spacing::XXL, spacing::XXL)
}
#[inline(always)]
pub fn XXXL() -> Spacer {
fixed(spacing::XXXL, spacing::XXXL)
}