add tooltip

This commit is contained in:
2026-10-29 20:16:27 +07:00
parent 2f81f2848d
commit ae39ee35f7
5 changed files with 42 additions and 12 deletions
+19 -10
View File
@@ -18,6 +18,7 @@ use gpui_native_core::scroll_area::ScrollArea;
use gpui_native_core::slider::Slider;
use gpui_native_core::switch::Switch;
use gpui_native_core::toggle::Toggle;
use gpui_native_core::tooltip::Tooltip;
use gpui_native_icons::{IconAssets, IconRole, icon};
use gpui_native_theme::{ActiveTheme as _, Theme};
use gpui_platform::application;
@@ -190,15 +191,22 @@ impl Render for Gallery {
.gap_2()
.children(button_variants.map(|(name, variant)| {
let gallery = gallery.clone();
Button::new(SharedString::from(format!("gallery-button-{name}")))
.label(button_label(variant))
.variant(variant)
.on_click(move |_, _, cx| {
gallery.update(cx, |gallery, cx| {
gallery.button_clicks += 1;
cx.notify();
});
})
let mut button = Button::new(SharedString::from(format!(
"gallery-button-{name}"
)))
.label(button_label(variant))
.variant(variant)
.on_click(move |_, _, cx| {
gallery.update(cx, |gallery, cx| {
gallery.button_clicks += 1;
cx.notify();
});
});
if variant == ButtonVariant::Destructive {
button =
button.tooltip(Tooltip::text("Removes the selected item"));
}
button
}))
.child(
Button::new("gallery-button-disabled")
@@ -208,7 +216,8 @@ impl Render for Gallery {
.child(
Button::new("gallery-button-icon")
.label("Open")
.icon(IconRole::Folder),
.icon(IconRole::Folder)
.tooltip(Tooltip::text("Opens the selected file")),
),
)
.child(