Skip to content

Commit

Permalink
feat: support border-style in divide plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Nov 3, 2022
1 parent 7e77e9f commit 9c15739
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions crates/tailwind-parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ mod plugin {
pub enum Divide {
X,
Y,
Solid,
Dashed,
Dotted,
Double,
None,
}

#[derive(Copy, Clone, Eq, PartialEq, Debug)]
Expand Down
13 changes: 11 additions & 2 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ pub fn divide(
match (d, rest.as_ref().map(|r| r.as_str())) {
(Some(Divide::X), Some("reverse")) => Some(to_lit(&[("--tw-divide-x-reverse", "1")])),
(Some(Divide::Y), Some("reverse")) => Some(to_lit(&[("--tw-divide-y-reverse", "1")])),
(Some(Divide::X), Some(rest)) => theme.divide_width.get(rest).map(|v| {
(Some(Divide::X), rest) => theme.divide_width.get(rest.unwrap_or("DEFAULT")).map(|v| {
to_lit(&[
("--tw-divide-x-reverse", "0"),
(
Expand All @@ -450,7 +450,7 @@ pub fn divide(
),
])
}),
(Some(Divide::Y), Some(rest)) => theme.divide_width.get(rest).map(|v| {
(Some(Divide::Y), rest) => theme.divide_width.get(rest.unwrap_or("DEFAULT")).map(|v| {
to_lit(&[
("--tw-divide-y-reverse", "0"),
(
Expand All @@ -463,6 +463,15 @@ pub fn divide(
),
])
}),
(Some(Divide::None), None) => Some(to_lit(&[("borderStyle", "none")])),
(Some(Divide::Double), None) => Some(to_lit(&[("borderStyle", "double")])),
(Some(Divide::Dotted), None) => Some(to_lit(&[("borderStyle", "dotted")])),
(Some(Divide::Dashed), None) => Some(to_lit(&[("borderStyle", "dashed")])),
(Some(Divide::Solid), None) => Some(to_lit(&[("borderStyle", "solid")])),
(None, Some(rest)) => theme
.colors
.get(rest)
.map(|v| to_lit(&[("borderColor", v)])),
_ => None,
}
.map(|lit| ObjectLit {
Expand Down

0 comments on commit 9c15739

Please sign in to comment.