From 73121123f31d7cf5afe190d514b82ad1c88a8693 Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Tue, 30 Jul 2024 11:24:29 +0800 Subject: [PATCH] Add custom button demo (#86) --- crates/story/src/button_story.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/story/src/button_story.rs b/crates/story/src/button_story.rs index c15c4107..62173d2f 100644 --- a/crates/story/src/button_story.rs +++ b/crates/story/src/button_story.rs @@ -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(