Add custom button demo (#86)

This commit is contained in:
Floyd Wang 2024-07-30 11:24:29 +08:00 committed by GitHub
parent fc6423f22c
commit 73121123f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,8 +4,10 @@ use gpui::{
};
use ui::{
button::{Button, ButtonStyle},
h_flex, v_flex, Clickable, Disableable as _, Icon, IconName, Selectable, Size,
button::{Button, ButtonCustomStyle, ButtonStyle},
h_flex,
theme::ActiveTheme,
v_flex, Clickable, Disableable as _, Icon, IconName, Selectable, Size,
};
use crate::section;
@ -60,6 +62,19 @@ impl Render for ButtonStory {
.label("Ghost Button")
.style(ButtonStyle::Ghost)
.on_click(Self::on_click),
)
.child(
Button::new("button-6-custom", cx)
.label("Custom Button")
.style(ButtonStyle::Custom(
ButtonCustomStyle::new(cx)
.color(cx.theme().muted)
.foreground(cx.theme().destructive)
.border(cx.theme().scrollbar)
.hover(cx.theme().tab_active_foreground)
.active(cx.theme().selection),
))
.on_click(Self::on_click),
),
)
.child(