Repository navigation
[6.x] UI tweaks: centered utility content and nav badges, type, shadow, and keycap polish - #20544
Merged
Merged
Conversation
Add Utility::contentMaxWidth(), which the utility page passes to the layout's contentMaxWidth option, the same one settings pages use. System Messages moves to it from its Vue component, and Yii2 Loose Ends uses it instead of capping its own body at max-w-4xl, which left it against the left edge on wide screens. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c31e-5888-7773-8b7a-d6900d7cccbf Co-authored-by: Amp <amp@ampcode.com>
craft-badge-indicator's host had no display of its own, so its inline-flex pill sat on the text baseline of a full line box, and came out low in rows that center their items, such as nav items' count badges and notifications' unread dots. Make the host inline-flex, which the notification bell and the Yii2 Loose Ends headings had each been doing for themselves. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c31e-5888-7773-8b7a-d6900d7cccbf Co-authored-by: Amp <amp@ampcode.com>
📚 Storybook previews@craftcms/ui — open Storybook Changed components:
resources/js — open Storybook No changed components detected in this Storybook. |
Antialias text on macOS, give tables, times, and count badges tabular figures, and tint every Craft shadow with a per-theme --c-shadow-tint instead of black. Move <kbd> styling into a shared kbd.css that craft-shortcut adopts too, so the shortcuts table and the command palette's footer draw the same keycap. Darken input borders inside sunken panes to 3:1. Drop --c-pane-shadow and the command palette's border, which were built on undefined variables and never applied. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1c31e-5888-7773-8b7a-d6900d7cccbf
Amp-Thread-ID: https://ampcode.com/threads/T-01a1c31e-5888-7773-8b7a-d6900d7cccbf Co-authored-by: Amp <amp@ampcode.com> # Conflicts: # CHANGELOG-WIP.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Small control panel layout fixes and visual polish.
Utilities can cap and center their content
Utility pages had no way to ask for the centered, readable-width column that settings pages use. System Messages got one by calling
useAppLayout({contentMaxWidth: true})from its own Vue component. Server-rendered utilities such as Yii2 Loose Ends couldn't do that, so Loose Ends capped its body atmax-w-4xland sat against the left edge on wide screens, with its title still at the left.Show.vueonly passes the option when a utility sets it, so a utility whose own component still callsuseAppLayout({contentMaxWidth: …})isn't overridden.Count badges and unread dots sit on their row's center line
craft-badge-indicator's host had nodisplay, so it was inline (or blockified, as a flex item), and theinline-flexpill inside it sat on the text baseline of a full line box. The host came out a line tall with the pill at its bottom, so in a centered row, such as a nav item's count badge or a notification's unread dot, the pill sat low.badge-indicator.styles.ts + :host { display: inline-flex; } cp-notification-center.ts .notification-trigger__badge - display: inline-flex (same workaround, now redundant) LooseEnds.twig craft-badge-indicator - class="inline-flex" (same workaround, now redundant)Visual polish through shared tokens and base styles
base.css body -webkit-font-smoothing: subpixel-antialiased → antialiased (+ -moz-osx-font-smoothing: grayscale) base.css :where(table, time) + font-variant-numeric: tabular-nums badge-indicator.styles.ts .number + font-variant-numeric: tabular-nums tokens.css + --c-shadow-tint: 34 44 82 (light) / 2 6 20 (dark) rgb(0 0 0 / …) → rgb(var(--c-shadow-tint) / …) in --c-shadow-*, sunken, input, slideout shadows and --c-modal-ring tokens.css - --c-pane-shadow (built on the undefined --gray-200, so it was already invalid; fld.css's one use goes too) kbd.css (new) one keycap style: Inter, quiet neutral fill and border, 2px bottom edge ├─ cp.css imports it for every <kbd> (was mono, in base.css) └─ craft-shortcut adopts it for its keys (was its own .shortcut__key rules) pane.styles.ts :host([appearance='sunken']) + --c-form-control-border-color: var(--color-slate-500) CommandPalette.vue - border: 1px var(--c-modal-border-style) var(--c-modal-border-color) (both undefined) - style="--c-modal-border-width: 0px"Evidence
Measured in the workbench at 1280px, before → after:
badge-indicator.browser.test.ts › centers a count / a dot in a row that centers its items: passes. Without the fix, they fail with the pill 2.8px and 1px low.UtilitiesControllerTest › caps and centers a utility's content only when the utility asks: passes. Without System Messages' opt-in, it fails withfalse is identical to true.composer ci,vue-tsc, stylelint, and the utilities and notifications Vitest files pass.Visual polish, measured in the workbench:
card.browser.test.ts › gives a card the light/dark theme's shadownow expects the tinted colors; the fullcomponents-browserproject passes (899 tests).The workbench doesn't load the Yii2 adapter, so Loose Ends itself was checked by reading the code, not by rendering it. There are no screenshots: I couldn't upload them to GitHub from the orb.