Skip to content

Commit

Permalink
feat: 修改display,支持block的输出
Browse files Browse the repository at this point in the history
  • Loading branch information
heiazu committed May 14, 2024
1 parent aac00fc commit 7d1d995
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/style_propetries/display.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


use lightningcss::properties::{Property, display::{Display::{Keyword, Pair}, DisplayKeyword, DisplayInside}};
use lightningcss::properties::{display::{Display::{Keyword, Pair}, DisplayInside, DisplayKeyword, DisplayOutside}, Property};

use crate::{generate_expr_lit_str, generate_invalid_expr};

Expand All @@ -16,6 +16,7 @@ pub struct Display {
pub enum EnumValue {
None,
Flex,
Block,
Invalid,
}

Expand All @@ -34,7 +35,11 @@ impl From<(String, &Property<'_>)> for Display {
if let DisplayInside::Flex(_) = value.inside {
EnumValue::Flex
} else {
EnumValue::Invalid
if let DisplayOutside::Block = value.outside {
EnumValue::Block
} else {
EnumValue::Invalid
}
}
}
}
Expand All @@ -54,6 +59,7 @@ impl ToExpr for Display {
match &self.value {
EnumValue::None => generate_expr_lit_str!("none"),
EnumValue::Flex => generate_expr_lit_str!("flex"),
EnumValue::Block => generate_expr_lit_str!("block"),
EnumValue::Invalid => generate_invalid_expr!(),
}
)
Expand All @@ -65,6 +71,7 @@ impl ToExpr for Display {
match &self.value {
EnumValue::None => generate_expr_lit_str!("none"),
EnumValue::Flex => generate_expr_lit_str!("flex"),
EnumValue::Block => generate_expr_lit_str!("block"),
EnumValue::Invalid => generate_invalid_expr!(),
}
)
Expand Down

0 comments on commit 7d1d995

Please # to comment.