add tooltip
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user