Skip to content

Commit

Permalink
add rounded property
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Aug 19, 2022
1 parent 13543d7 commit 404d986
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/config.rs
Expand Up @@ -26,6 +26,8 @@ pub struct TailwindTheme<'a> {
pub font_size: HashMap<&'a str, (&'a str, LineHeight<'a>)>,
#[serde(borrow, rename = "fontWeight")]
pub font_weight: HashMap<&'a str, &'a str>,
#[serde(borrow, rename = "borderRadius")]
pub border_radius: HashMap<&'a str, &'a str>,
}

#[derive(Deserialize, Debug)]
Expand Down
4 changes: 4 additions & 0 deletions src/parse/literal.rs
Expand Up @@ -21,6 +21,10 @@ pub fn parse_literal<'a>(theme: &TailwindTheme, s: &'a str) -> Result<ObjectLit,
Ok(Type::Color(x)) => Ok(create_literal("borderColor", x)),
_ => Err(s),
},
("rounded", rest) => match theme.border_radius.get(rest) {
Some(val) => Ok(create_literal("borderRadius", val)),
None => Err(s),
},
("bg", rest) => Ok(create_literal("backgroundColor", rest)),
("h", rest) => Ok(create_literal("height", &format!("{}em", rest,))),
("w", rest) => Ok(create_literal("width", &format!("{}em", rest,))),
Expand Down

0 comments on commit 404d986

Please sign in to comment.