diff --git a/demo/src/components/site_header.rs b/demo/src/components/site_header.rs
index 78593e7..2141d39 100644
--- a/demo/src/components/site_header.rs
+++ b/demo/src/components/site_header.rs
@@ -152,7 +152,7 @@ pub fn SiteHeader() -> impl IntoView {
}
```
-### Color
+### Shape
```rust demo
view! {
-
-
-
-
+
+
+
}
```
@@ -76,6 +75,20 @@ view! {
}
```
+### Color
+
+```rust demo
+view! {
+
+
+
+
+
+
+}
+```
+
+
### Loading
```rust demo
@@ -107,16 +120,16 @@ view! {
```rust demo
view! {
-
@@ -171,7 +184,7 @@ view! {
| --- | --- | --- | --- |
| class | `OptionalProp>` | `Default::default()` | Additional classes for the button element. |
| style | `Option>` | `Default::default()` | Button's style. |
-| variant | `MaybeSignal` | `ButtonAppearance::Primary` | Button's variant. |
+| appearance | `MaybeSignal` | `ButtonAppearance::Primary` | Button's variant. |
| color | `MaybeSignal` | `ButtonColor::Primary` | Button's color. |
| block | `MaybeSignal` | `false` | Whether the button is displayed as block. |
| round | `MaybeSignal` | `false` | Whether the button shows rounded corners. |
diff --git a/thaw/src/button/button.css b/thaw/src/button/button.css
index 9f6fab3..d9a0c58 100644
--- a/thaw/src/button/button.css
+++ b/thaw/src/button/button.css
@@ -90,6 +90,13 @@
border-color: transparent;
}
+.thaw-button--circular {
+ border-radius: var(--borderRadiusCircular);
+}
+.thaw-button--square {
+ border-radius: var(--borderRadiusNone);
+}
+
.thaw-button--block {
display: flex;
width: 100%;
diff --git a/thaw/src/button/mod.rs b/thaw/src/button/mod.rs
index ef3e674..339a926 100644
--- a/thaw/src/button/mod.rs
+++ b/thaw/src/button/mod.rs
@@ -29,6 +29,24 @@ impl ButtonAppearance {
}
}
+#[derive(Default, PartialEq, Clone, Copy)]
+pub enum ButtonShape {
+ #[default]
+ Rounded,
+ Circular,
+ Square
+}
+
+impl ButtonShape {
+ fn as_str(&self) -> &str {
+ match self {
+ ButtonShape::Rounded => "rounded",
+ ButtonShape::Circular => "circular",
+ ButtonShape::Square => "square",
+ }
+ }
+}
+
#[derive(Default, Clone)]
pub enum ButtonColor {
#[default]
@@ -76,15 +94,6 @@ pub enum ButtonSize {
}
impl ButtonSize {
- fn theme_font_size(&self, theme: &Theme) -> String {
- match self {
- ButtonSize::Tiny => theme.common.font_size_tiny.clone(),
- ButtonSize::Small => theme.common.font_size_small.clone(),
- ButtonSize::Medium => theme.common.font_size_medium.clone(),
- ButtonSize::Large => theme.common.font_size_large.clone(),
- }
- }
-
fn theme_height(&self, theme: &Theme) -> String {
match self {
ButtonSize::Tiny => theme.common.height_tiny.clone(),
@@ -108,7 +117,8 @@ impl ButtonSize {
pub fn Button(
#[prop(optional, into)] style: Option>,
#[prop(optional, into)] class: OptionalProp>,
- #[prop(optional, into)] variant: MaybeSignal,
+ #[prop(optional, into)] appearance: MaybeSignal,
+ #[prop(optional, into)] shape: MaybeSignal,
#[prop(optional, into)] color: MaybeSignal,
#[prop(optional, into)] size: MaybeSignal,
#[prop(optional, into)] block: MaybeSignal,
@@ -129,10 +139,6 @@ pub fn Button(
"--thaw-font-color-disabled: {};",
theme.button.color_text_disabled
));
- css_vars.push_str(&format!(
- "--thaw-font-size: {};",
- size.get().theme_font_size(theme)
- ));
css_vars.push_str(&format!(
"--thaw-height: {};",
size.get().theme_height(theme)
@@ -142,7 +148,7 @@ pub fn Button(
size.get().theme_padding(theme)
));
- match variant.get() {
+ match appearance.get() {
ButtonAppearance::Secondary => {}
ButtonAppearance::Primary => {
let bg_color_hover = color.get().theme_color_hover(theme);
@@ -190,7 +196,7 @@ pub fn Button(
mount_style("button", include_str!("./button.css"));
let icon_style = if children.is_some() {
- "margin-right: 6px"
+ "margin-right: var(--spacingHorizontalSNudge)"
} else {
""
};
@@ -224,7 +230,8 @@ pub fn Button(
"thaw-button", ("thaw-button--round", move || round.get()),
("thaw-button--circle", move || circle.get()), ("thaw-button--disabled", move ||
disabled.get()), ("thaw-button--block", move || block.get()),
- move || format!("thaw-button--{}", variant.get().as_str()),
+ move || format!("thaw-button--{}", appearance.get().as_str()),
+ move || format!("thaw-button--{}", shape.get().as_str()),
class.map(| c | move || c.get())
]
diff --git a/thaw/src/card/mod.rs b/thaw/src/card/mod.rs
index 437b0e1..5468546 100644
--- a/thaw/src/card/mod.rs
+++ b/thaw/src/card/mod.rs
@@ -34,9 +34,10 @@ pub fn Card(
let css_vars = create_memo(move |_| {
let mut css_vars = String::new();
theme.with(|theme| {
+ // TODO
css_vars.push_str(&format!(
- "--thaw-background-color: {};",
- theme.common.background_color
+ "--thaw-background-color: ;",
+ // theme.common.background_color
));
css_vars.push_str(&format!(
"--thaw-border-color: {};",
diff --git a/thaw/src/config_provider/mod.rs b/thaw/src/config_provider/mod.rs
index bfb69db..e2e66cb 100644
--- a/thaw/src/config_provider/mod.rs
+++ b/thaw/src/config_provider/mod.rs
@@ -13,52 +13,52 @@ pub fn ConfigProvider(
let css_vars = Memo::new(move |_| {
let mut css_vars = String::new();
theme.with(|theme| {
- css_vars.push_str(&format!(
- "--fontFamilyBase: {};",
- theme.common.font_family_base
- ));
- css_vars.push_str(&format!(
- "--fontSizeBase300: {};",
- theme.common.font_size_base_300
- ));
- css_vars.push_str(&format!(
- "--lineHeightBase300: {};",
- theme.common.line_height_base300,
- ));
- css_vars.push_str(&format!(
- "--fontWeightRegular: {};",
- theme.common.font_weight_regular
- ));
- css_vars.push_str(&format!(
- "--fontWeightSemibold: {};",
- theme.common.font_weight_semibold
- ));
- css_vars.push_str(&format!(
- "--fontWeightBold: {};",
- theme.common.font_weight_bold
- ));
- css_vars.push_str(&format!(
- "--strokeWidthThin: {};",
- theme.common.stroke_width_thin,
- ));
- css_vars.push_str(&format!(
- "--borderRadiusMedium: {};",
- theme.common.border_radius_medium
- ));
- css_vars.push_str(&format!(
- "--spacingHorizontalM: {};",
- theme.common.spacing_horizontal_m
- ));
+ // css_vars.push_str(&format!(
+ // "--fontFamilyBase: {};",
+ // theme.common.font_family_base
+ // ));
+ // css_vars.push_str(&format!(
+ // "--fontSizeBase300: {};",
+ // theme.common.font_size_base_300
+ // ));
+ // css_vars.push_str(&format!(
+ // "--lineHeightBase300: {};",
+ // theme.common.line_height_base300,
+ // ));
+ // css_vars.push_str(&format!(
+ // "--fontWeightRegular: {};",
+ // theme.common.font_weight_regular
+ // ));
+ // css_vars.push_str(&format!(
+ // "--fontWeightSemibold: {};",
+ // theme.common.font_weight_semibold
+ // ));
+ // css_vars.push_str(&format!(
+ // "--fontWeightBold: {};",
+ // theme.common.font_weight_bold
+ // ));
+ // css_vars.push_str(&format!(
+ // "--strokeWidthThin: {};",
+ // theme.common.stroke_width_thin,
+ // ));
+ // css_vars.push_str(&format!(
+ // "--borderRadiusMedium: {};",
+ // theme.common.border_radius_medium
+ // ));
+ // css_vars.push_str(&format!(
+ // "--spacingHorizontalM: {};",
+ // theme.common.spacing_horizontal_m
+ // ));
- css_vars.push_str(&format!(
- "--durationFaster: {};",
- theme.common.duration_faster
- ));
- css_vars.push_str(&format!(
- "--curveEasyEase: {};",
- theme.common.curve_easy_ease
- ));
-
+ // css_vars.push_str(&format!(
+ // "--durationFaster: {};",
+ // theme.common.duration_faster
+ // ));
+ // css_vars.push_str(&format!(
+ // "--curveEasyEase: {};",
+ // theme.common.curve_easy_ease
+ // ));
+ theme.common.write_css_vars(&mut css_vars);
theme.color.write_css_vars(&mut css_vars);
});
css_vars
diff --git a/thaw/src/date_picker/panel/date_panel.rs b/thaw/src/date_picker/panel/date_panel.rs
index d79c2fe..e02ca11 100644
--- a/thaw/src/date_picker/panel/date_panel.rs
+++ b/thaw/src/date_picker/panel/date_panel.rs
@@ -88,27 +88,27 @@ pub fn DatePanel(