Skip to content

Commit

Permalink
feat: add align plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Nov 30, 2022
1 parent d7c9331 commit 3f69b75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/tailwind-parse/src/eval/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ lookup_plugin_arbitrary!(max_h, max_height, "maxHeight");

lookup_plugin!(leading, line_height, "lineHeight");

pub fn align(Value(rest): &Value, _theme: &TailwindTheme) -> Option<ObjectLit> {
match *rest {
"baseline" => Some(to_lit(&[("verticalAlign", "baseline")])),
"top" => Some(to_lit(&[("verticalAlign", "top")])),
"middle" => Some(to_lit(&[("verticalAlign", "middle")])),
"bottom" => Some(to_lit(&[("verticalAlign", "bottom")])),
"text-top" => Some(to_lit(&[("verticalAlign", "text-top")])),
"text-bottom" => Some(to_lit(&[("verticalAlign", "text-bottom")])),
"sub" => Some(to_lit(&[("verticalAlign", "sub")])),
"super" => Some(to_lit(&[("verticalAlign", "super")])),
_ => None,
}
}

pub fn rounded(
subcommand: Option<Rounded>,
rest: &Option<SubjectValue>,
Expand Down
1 change: 1 addition & 0 deletions crates/tailwind-parse/src/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ impl<'a> Literal<'a> {
Px => Required(plugin::px),
Pl => Required(plugin::pl),
Pr => Required(plugin::pr),
VerticalAlign => Required(plugin::align),
Py => Required(plugin::py),
Pt => Required(plugin::pt),
Pb => Required(plugin::pb),
Expand Down
2 changes: 2 additions & 0 deletions crates/tailwind-parse/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ mod plugin {
Pr,
Py,
Pt,
#[rename("align")]
VerticalAlign,
Pb,
M,
Mx,
Expand Down

0 comments on commit 3f69b75

Please sign in to comment.