Skip to content

Commit

Permalink
add font property
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Aug 19, 2022
1 parent 404d986 commit a9f9288
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/parse/literal.rs
@@ -1,3 +1,4 @@
use itertools::Itertools;
use swc_common::DUMMY_SP;
use swc_ecma_visit::swc_ecma_ast::{
Expr, KeyValueProp, Lit, ObjectLit, Prop, PropName, PropOrSpread, Str,
Expand All @@ -16,6 +17,10 @@ pub fn parse_literal<'a>(theme: &TailwindTheme, s: &'a str) -> Result<ObjectLit,
Ok(Type::Color(x)) => Ok(create_literal("color", x)),
_ => Err(s),
},
("font", rest) => match theme.font_family.get(rest) {
Some(val) => Ok(create_literal("fontFamily", &val.iter().join(", "))),
None => Err(s),
},
("border", rest) => match infer_type(theme, rest) {
Ok(Type::Scalar(x)) => Ok(create_literal("borderWidth", &format!("{}px", x))),
Ok(Type::Color(x)) => Ok(create_literal("borderColor", x)),
Expand Down

0 comments on commit a9f9288

Please sign in to comment.