Skip to content

Commit

Permalink
add ui_button_primary ui_button_danger; tag 0.0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Dec 22, 2022
1 parent 7ff9325 commit 1049c9e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions demo_respo/src/plugins.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::fmt::Debug;

use respo::ui::{ui_button_danger, ui_button_primary};
use respo::RespoEvent;
use respo::{space, ui::ui_row_parted, RespoStyle};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -208,13 +209,13 @@ pub fn comp_plugins_demo(states: &StatesTree) -> Result<RespoNode<ActionOp>, Str
button().class(ui_button()).inner_text("Try Prompt").on_click(on_prompt).to_owned(),
space(Some(8), None),
button()
.class(ui_button())
.class(ui_button_primary())
.inner_text("Try Custom Modal")
.on_click(on_modal)
.to_owned(),
space(Some(8), None),
button()
.class(ui_button())
.class(ui_button_danger())
.inner_text("Try Custom Drawer")
.on_click(on_drawer)
.to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion respo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "respo"
version = "0.0.15"
version = "0.0.16"
edition = "2021"
description = "a tiny virtual DOM library migrated from ClojureScript"
license = "Apache-2.0"
Expand Down
56 changes: 55 additions & 1 deletion respo/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,61 @@ static_styles!(
(
"$0:active",
RespoStyle::default()
.transform(CssTransform::Scale(1.04, 1.04))
.transform(CssTransform::Scale(1.02, 1.02))
.transition_duration(0.0),
),
);

static_styles!(
ui_button_primary,
(
"$0",
RespoStyle::default()
.outline(None)
.color(CssColor::White)
.background_color(CssColor::Hsl(220, 80, 60))
.border(Some((0., CssBorderStyle::Solid, CssColor::Hsl(220, 80, 60))))
.min_width(CssSize::Px(80.))
.line_height(CssLineHeight::Px(24.))
.border_radius(4.)
.font_size(14.)
.cursor("pointer".to_owned())
.transition_duration(200.)
.text_align(CssTextAlign::Center),
),
("$0:hover", RespoStyle::default().background_color(CssColor::Hsl(220, 80, 64))),
(
"$0:active",
RespoStyle::default()
.transform(CssTransform::Scale(1.02, 1.02))
.background_color(CssColor::Hsl(220, 80, 68))
.transition_duration(0.0),
),
);

static_styles!(
ui_button_danger,
(
"$0",
RespoStyle::default()
.outline(None)
.color(CssColor::White)
.background_color(CssColor::Hsl(6, 100, 60))
.border(Some((0., CssBorderStyle::Solid, CssColor::Hsl(6, 100, 60))))
.min_width(CssSize::Px(80.))
.line_height(CssLineHeight::Px(24.))
.border_radius(4.)
.font_size(14.)
.cursor("pointer".to_owned())
.transition_duration(200.)
.text_align(CssTextAlign::Center),
),
("$0:hover", RespoStyle::default().background_color(CssColor::Hsl(6, 100, 64))),
(
"$0:active",
RespoStyle::default()
.transform(CssTransform::Scale(1.02, 1.02))
.background_color(CssColor::Hsl(6, 100, 68))
.transition_duration(0.0),
),
);
Expand Down

0 comments on commit 1049c9e

Please sign in to comment.