use crate::traits::ToCss;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum BorderRadius {
#[default]
None,
Xs,
Sm,
Md,
Lg,
Xl,
S2xl,
S3xl,
S4xl,
Full,
}
impl ToCss for BorderRadius {
fn to_css(&self) -> String {
match self {
BorderRadius::None => "0".to_string(),
BorderRadius::Xs => "0.125rem".to_string(),
BorderRadius::Sm => "0.25rem".to_string(),
BorderRadius::Md => "0.375rem".to_string(),
BorderRadius::Lg => "0.5rem".to_string(),
BorderRadius::Xl => "0.75rem".to_string(),
BorderRadius::S2xl => "1rem".to_string(),
BorderRadius::S3xl => "1.5rem".to_string(),
BorderRadius::S4xl => "2rem".to_string(),
BorderRadius::Full => "9999px".to_string(),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum BorderWidth {
S0,
S1,
S2,
S4,
S8,
}
impl ToCss for BorderWidth {
fn to_css(&self) -> String {
match self {
BorderWidth::S0 => "0".to_string(),
BorderWidth::S1 => "1px".to_string(),
BorderWidth::S2 => "2px".to_string(),
BorderWidth::S4 => "4px".to_string(),
BorderWidth::S8 => "8px".to_string(),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum BorderStyle {
Solid,
Dashed,
Dotted,
Double,
Hidden,
None,
}
impl ToCss for BorderStyle {
fn to_css(&self) -> String {
match self {
BorderStyle::Solid => "solid".to_string(),
BorderStyle::Dashed => "dashed".to_string(),
BorderStyle::Dotted => "dotted".to_string(),
BorderStyle::Double => "double".to_string(),
BorderStyle::Hidden => "hidden".to_string(),
BorderStyle::None => "none".to_string(),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum OutlineStyle {
None,
Solid,
Dashed,
Dotted,
Double,
Hidden,
}
impl ToCss for OutlineStyle {
fn to_css(&self) -> String {
match self {
OutlineStyle::None => "none".to_string(),
OutlineStyle::Solid => "solid".to_string(),
OutlineStyle::Dashed => "dashed".to_string(),
OutlineStyle::Dotted => "dotted".to_string(),
OutlineStyle::Double => "double".to_string(),
OutlineStyle::Hidden => "hidden".to_string(),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum RingWidth {
None,
S1,
S2,
S4,
S8,
Inset,
}
impl ToCss for RingWidth {
fn to_css(&self) -> String {
match self {
RingWidth::None => "0".to_string(),
RingWidth::S1 => "1px".to_string(),
RingWidth::S2 => "2px".to_string(),
RingWidth::S4 => "4px".to_string(),
RingWidth::S8 => "8px".to_string(),
RingWidth::Inset => "inset".to_string(),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum DivideWidth {
S0,
S1,
S2,
S4,
S8,
}
impl ToCss for DivideWidth {
fn to_css(&self) -> String {
match self {
DivideWidth::S0 => "0".to_string(),
DivideWidth::S1 => "1px".to_string(),
DivideWidth::S2 => "2px".to_string(),
DivideWidth::S4 => "4px".to_string(),
DivideWidth::S8 => "8px".to_string(),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_border_radius() {
assert_eq!(BorderRadius::Md.to_css(), "0.375rem");
assert_eq!(BorderRadius::Full.to_css(), "9999px");
}
#[test]
fn test_border_width() {
assert_eq!(BorderWidth::S2.to_css(), "2px");
}
}