Skip to content

Commit

Permalink
feat: add the rest of basic button styles
Browse files Browse the repository at this point in the history
  • Loading branch information
golota60 committed Jan 2, 2024
1 parent 19d0baf commit dfce22f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 22 deletions.
67 changes: 52 additions & 15 deletions examples/widget-gallery/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,70 @@ fn app_view() -> impl View {
variant: ButtonVariant::Neutral,
..Default::default()
}),
)
.on_click(move |_| {
set_counter.update(|value| *value += 1);
EventPropagation::Stop
}),
),
oxy_button(
|| "Primary",
Some(ButtonProps {
variant: ButtonVariant::Primary,
..Default::default()
}),
)
.on_click(move |_| {
set_counter.update(|value| *value -= 1);
EventPropagation::Stop
}),
),
oxy_button(
|| "Secondary",
Some(ButtonProps {
variant: ButtonVariant::Secondary,
..Default::default()
}),
)
.on_click(move |_| {
set_counter.update(|value| *value -= 1);
EventPropagation::Stop
}),
),
oxy_button(
|| "Accent",
Some(ButtonProps {
variant: ButtonVariant::Accent,
..Default::default()
}),
),
oxy_button(
|| "Ghost",
Some(ButtonProps {
variant: ButtonVariant::Ghost,
..Default::default()
}),
),
oxy_button(
|| "Link",
Some(ButtonProps {
variant: ButtonVariant::Link,
..Default::default()
}),
),
oxy_button(
|| "Info",
Some(ButtonProps {
variant: ButtonVariant::Info,
..Default::default()
}),
),
oxy_button(
|| "Success",
Some(ButtonProps {
variant: ButtonVariant::Success,
..Default::default()
}),
),
oxy_button(
|| "Warning",
Some(ButtonProps {
variant: ButtonVariant::Warning,
..Default::default()
}),
),
oxy_button(
|| "Error",
Some(ButtonProps {
variant: ButtonVariant::Error,
..Default::default()
}),
),
)),
label(|| "CHECKBOXES(first-floem, second-oxytail)"),
oxy_checkbox(checked).on_click_stop(move |_| {
Expand Down
14 changes: 7 additions & 7 deletions src/widgets/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ impl ButtonVariant {
ButtonVariant::Neutral => |s: Style| s.background(Color::rgb8(42, 50, 60)),
ButtonVariant::Primary => |s: Style| s.background(Color::rgb8(116, 128, 255)),
ButtonVariant::Secondary => |s: Style| s.background(Color::rgb8(255, 82, 217)),
ButtonVariant::Accent => |s: Style| s.background(Color::rgb8(42, 50, 60)),
ButtonVariant::Ghost => |s: Style| s.background(Color::rgb8(42, 50, 60)),
ButtonVariant::Link => |s: Style| s.background(Color::rgb8(42, 50, 60)),
ButtonVariant::Accent => |s: Style| s.background(Color::rgb8(0, 205, 183)),
ButtonVariant::Ghost => |s: Style| s.background(Color::TRANSPARENT),
ButtonVariant::Link => |s: Style| s.background(Color::rgb8(117, 130, 255)),

ButtonVariant::Info => |s: Style| s.background(Color::rgb8(42, 50, 60)),
ButtonVariant::Success => |s: Style| s.background(Color::rgb8(42, 50, 60)),
ButtonVariant::Warning => |s: Style| s.background(Color::rgb8(42, 50, 60)),
ButtonVariant::Error => |s: Style| s.background(Color::rgb8(42, 50, 60)),
ButtonVariant::Info => |s: Style| s.background(Color::rgb8(0, 181, 255)),
ButtonVariant::Success => |s: Style| s.background(Color::rgb8(0, 169, 110)),
ButtonVariant::Warning => |s: Style| s.background(Color::rgb8(255, 190, 0)),
ButtonVariant::Error => |s: Style| s.background(Color::rgb8(255, 88, 97)),
}
}
}
Expand Down

0 comments on commit dfce22f

Please sign in to comment.