Skip to main content

orbital_shell/tokens/
corner_radius.rs

1//! Border radius scale for Orbital shapes.
2
3/// Corner radius for marketing surfaces, cards, and controls.
4#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
5pub enum CornerRadius {
6    /// No rounding (rare; dividers, full-bleed strips).
7    None,
8    /// 4px — buttons, dense chips, small badges.
9    Small,
10    /// 8px — primary buttons, dense cards.
11    Medium,
12    /// 12px — marketing surfaces, popovers, callouts.
13    Large,
14    /// 16px — hero shells, large marketing cards.
15    XLarge,
16    /// 16px — rounded-square floating action controls.
17    Floating,
18    /// 50% — icon discs, avatars.
19    Circle,
20}
21
22impl CornerRadius {
23    /// Stable CSS class for composition (pairs with global marketing token styles).
24    pub const fn as_class(self) -> &'static str {
25        match self {
26            Self::None => "orbital-token-radius-none",
27            Self::Small => "orbital-token-radius-small",
28            Self::Medium => "orbital-token-radius-medium",
29            Self::Large => "orbital-token-radius-large",
30            Self::XLarge => "orbital-token-radius-xlarge",
31            Self::Floating => "orbital-token-radius-floating",
32            Self::Circle => "orbital-token-radius-circle",
33        }
34    }
35
36    /// Theme token when available; otherwise a concrete `border-radius` value.
37    pub const fn as_token(self) -> &'static str {
38        match self {
39            Self::None => "0",
40            Self::Small => "var(--orb-radius-sm)",
41            Self::Medium => "var(--orb-radius-md)",
42            Self::Large => "var(--orb-radius-lg)",
43            Self::XLarge => "var(--orb-radius-xl)",
44            Self::Floating => "var(--orb-radius-floating)",
45            Self::Circle => "50%",
46        }
47    }
48}