From 237e2a156648abde78df3ce1f91596cc3440addb Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 12 Nov 2026 14:46:19 +0000 Subject: [PATCH] Panel footer actions show their icons at the tool size (size.icon.md) --- crates/ui-contract/src/style/cx.rs | 3 ++- crates/ui-panels/src/sections/footer.rs | 10 ++++++---- docs/craft-framework.md | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/ui-contract/src/style/cx.rs b/crates/ui-contract/src/style/cx.rs index c217b0798..bbd76ec2d 100644 --- a/crates/ui-contract/src/style/cx.rs +++ b/crates/ui-contract/src/style/cx.rs @@ -29,7 +29,8 @@ pub enum GlyphRole { /// A glyph inside a control: `size.icon.glyph_sm` or `glyph_md` by the control size, in the variant's ink. #[default] Control, - /// A command strip of tool icons (align and distribute): `size.icon.md`, in the variant's ink. + /// A command strip of tool icons (align and distribute) or a panel footer's actions: `size.icon.md`, in the + /// variant's ink. Tool, /// A tool rail: `size.icon.lg`, resting in `text.muted` and in the variant's ink under the pointer. ToolRail, diff --git a/crates/ui-panels/src/sections/footer.rs b/crates/ui-panels/src/sections/footer.rs index 552ae6184..3c9f94d33 100644 --- a/crates/ui-panels/src/sections/footer.rs +++ b/crates/ui-panels/src/sections/footer.rs @@ -12,7 +12,7 @@ use crate::runtime::access::Name; use crate::runtime::env::{Env, EnvValue, Label}; use crate::runtime::focus; use crate::runtime::keys; -use crate::style::{ComponentStyle, RuleKind, StyleCx}; +use crate::style::{ComponentStyle, GlyphRole, RuleKind, StyleCx}; use craft_behavior::{Insets, Metrics, OwnerClass, Sense}; use craft_host::target::Os; use craft_keymap::{Chord, Key}; @@ -566,10 +566,12 @@ impl FooterBar { /// A footer bar of icon actions laid out from the reading end, as Photoshop's panel footers: the first action given /// sits at the end edge (Delete), the next one before it, and a panel menu given last at the start of the group. - /// Tab visits them in display order; the indexes the output reports are those of the given order. Show it with - /// `show_footer`. + /// Tab visits them in display order; the indexes the output reports are those of the given order. The actions show + /// their icons at the tool size (`GlyphRole::Tool`). Show it with `show_footer`. pub fn actions(actions: impl IntoIterator) -> Self { - FooterBar { content: Content::Actions(actions.into_iter().collect()), actions: true, ..FooterBar::body() } + let body = FooterBar::body(); + let props = body.props.child_glyphs(GlyphRole::Tool); + FooterBar { content: Content::Actions(actions.into_iter().collect()), actions: true, props, ..body } } /// The first `count` actions sit at the start edge in the given order and the rest from the end edge as diff --git a/docs/craft-framework.md b/docs/craft-framework.md index 382bc7c99..fb4961f94 100644 --- a/docs/craft-framework.md +++ b/docs/craft-framework.md @@ -973,7 +973,7 @@ A theme with its own shape replaces the radii or adds an offset to control, surf | Role | Components | | --- | --- | | `size.control.sm`, `size.control.md` | Controls, fields, buttons | -| `size.icon.sm`, `size.icon.md`, `size.icon.lg` | Icons; `md` is the glyph of a tool strip (`GlyphRole::Tool`), `lg` of a tool rail (`GlyphRole::ToolRail`). A stroke icon below `md` draws `stroke.thin`, from `md` up `stroke.medium` | +| `size.icon.sm`, `size.icon.md`, `size.icon.lg` | Icons; `md` is the glyph of a tool strip and of a panel footer's actions (`GlyphRole::Tool`), `lg` of a tool rail (`GlyphRole::ToolRail`). A stroke icon below `md` draws `stroke.thin`, from `md` up `stroke.medium` | | `size.icon.glyph_sm`, `size.icon.glyph_md` | The glyph in an icon-only button (`GlyphRole::Control`, the default; a container sets another with `ContainerProps::child_glyphs`) | | `size.bar.title`, `size.bar.tab`, `size.bar.status`, `size.bar.options`, `size.bar.options_narrow` | Title bar, document tab bar, status bar, options bar | | `size.panel_header` | Panel headers |