mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 02:36:54 +01:00
backstage: the glyph Back is a side-menu row face with its label unpainted
The glyph lines up with the entries' glyphs at the side menu's icon size instead of a small icon button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fc5cb2bab5
commit
04ffcdba24
1 file changed
+6
-11
@@ -7,7 +7,7 @@ use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
|
||||
use craft_behavior::{Metrics, NavShape, Roving};
|
||||
use craft_ui::buttons::{Button, ControlPlace, IconButton};
|
||||
use craft_ui::buttons::{Button, ControlPlace};
|
||||
use craft_ui::contract::{
|
||||
BodyCx, BodyLayout, Common, Component, Container, ContainerProps, Cx, Gap, LeastWidth, NoValue, Outcome, Pad, Props as _, Role, Scroll,
|
||||
Show as _, ShowContainer as _, Sizing,
|
||||
@@ -139,18 +139,13 @@ impl<'a, K: Clone + Eq + Hash + Send + Sync + Debug + 'static> BackstageView<'a,
|
||||
.show_at(ui, rail, |ui, _| {
|
||||
if self.back {
|
||||
let glyph = craft_behavior::IconId::new("chevron_left");
|
||||
// The glyph alone is still a side-menu row's face, so its glyph lines up with the entries'.
|
||||
let back = Button::new(words.back.clone()).icon(glyph).variant(Variant::GHOST).align(HAlign::Start);
|
||||
let back = match self.back_look {
|
||||
BackLook::Labelled => {
|
||||
Button::new(words.back.clone())
|
||||
.icon(glyph)
|
||||
.variant(Variant::GHOST)
|
||||
.sizing(Sizing::FillWidth)
|
||||
.align(HAlign::Start)
|
||||
.show(ui)
|
||||
.response
|
||||
}
|
||||
BackLook::Glyph => IconButton::new(glyph).label(words.back.clone()).tooltip(words.back.clone()).show(ui).response,
|
||||
BackLook::Labelled => back.sizing(Sizing::FillWidth),
|
||||
BackLook::Glyph => back.painted(Label::Empty).tooltip(words.back.clone()),
|
||||
};
|
||||
let back = back.show(ui).response;
|
||||
if craft_ui::contract::clicked(&back) {
|
||||
event = Some(BackstageEvent::Back);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user