mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 19:47:53 +00:00
Show labels beside About link icons
This commit is contained in:
@@ -335,7 +335,7 @@ impl Shown<'_> {
|
||||
Text::new("·").shade(Shade::Faint).show(ui);
|
||||
}
|
||||
let activated = if let Some(icon) = &item.icon {
|
||||
clicked(&IconButton::new(icon.clone()).label(item.label.clone()).tooltip(item.label.clone()).id_salt(("link", at)).show(ui))
|
||||
clicked(&Button::new(item.label.clone()).icon(icon.clone()).variant(Variant::GHOST).id_salt(("link", at)).show(ui))
|
||||
} else {
|
||||
clicked(&Link::new(item.label.clone()).id_salt(("link", at)).show(ui))
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ pub struct AboutLink {
|
||||
pub label: Label,
|
||||
/// The target URL, reported in the output for the app to open.
|
||||
pub url: String,
|
||||
/// An icon to show in place of link text, with the label retained for accessibility.
|
||||
/// An icon to show beside the link text.
|
||||
pub icon: Option<craft_behavior::IconId>,
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ impl AboutLink {
|
||||
AboutLink { label: label.into(), url: url.into(), icon: None }
|
||||
}
|
||||
|
||||
/// Shows this link as an icon button.
|
||||
/// Shows this link with an icon beside its label.
|
||||
#[must_use]
|
||||
pub fn icon(mut self, icon: craft_behavior::IconId) -> Self {
|
||||
self.icon = Some(icon);
|
||||
|
||||
Reference in New Issue
Block a user