Skip to content

Commit

Permalink
feat: add justify plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Aug 19, 2022
1 parent 2847079 commit ec09cca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/parse/literal.rs
Expand Up @@ -25,6 +25,7 @@ pub fn parse_literal<'a>(theme: &TailwindTheme, s: &'a str) -> Result<ObjectLit,
"grow" => plugin::grow,
"shrink" => plugin::shrink,
"basis" => plugin::basis,
"justify" => plugin::justify,
"gap" => plugin::gap,
"cursor" => plugin::cursor,
"scale" => plugin::scale,
Expand Down
13 changes: 13 additions & 0 deletions src/plugin.rs
Expand Up @@ -117,6 +117,19 @@ pub fn shrink(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
simple_lookup(&theme.flex_shrink, rest, "flexShrink")
}

pub fn justify(rest: &str, _theme: &TailwindTheme) -> Option<ObjectLit> {
match rest {
"start" => Some("flex-start"),
"end" => Some("flex-end"),
"center" => Some("center"),
"between" => Some("between"),
"around" => Some("around"),
"evenly" => Some("evenly"),
_ => None,
}
.map(|v| to_lit(&[("justifyContent", v)]))
}

pub fn gap(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
simple_lookup(&theme.gap, rest, "gap")
}
Expand Down

0 comments on commit ec09cca

Please sign in to comment.