From 273776dc9825180fd9d9ee9695d1fa53e6b61700 Mon Sep 17 00:00:00 2001 From: Sam Julien Date: Tue, 1 Dec 2026 18:10:40 -0800 Subject: [PATCH] Message box at rest: a hairline ring and shadow-xs, the glow unchanged The message box at rest was a flat card with a 1px border. It is now a card with a hairline ring of `border` and `shadow-xs` under it, so it sits a little above the page. Its border stays, transparent, so the typing glow has a border to tint. The glow while typing is the same five classes as before. The resting shadow takes no opacity of its own: `shadow-ring/20`, the glow's shadow color, is multiplied by `--tw-shadow-alpha`, so a `shadow-lg/5` at rest would all but put the glow out. docs/app-guidelines.md, The look: rule 8 says what the box is at rest, and rule 5 lists the box with `shadow-xs`. message-box-frame.test.ts holds the resting classes and the glow's exact classes. --- app/src/components/channels/composer/frame.ts | 20 ++++++---- app/tests/message-box-frame.test.ts | 38 +++++++++---------- app/tests/ui-look-guard.test.ts | 3 +- docs/app-guidelines.md | 8 ++-- 4 files changed, 38 insertions(+), 31 deletions(-) diff --git a/app/src/components/channels/composer/frame.ts b/app/src/components/channels/composer/frame.ts index cbebc0e0c3..c47f88dd43 100644 --- a/app/src/components/channels/composer/frame.ts +++ b/app/src/components/channels/composer/frame.ts @@ -1,13 +1,17 @@ /** * The message box's frame, shared by its two layouts (docs/app-guidelines.md, "The look"). * - * At rest it is a card like any other: flat, with a hairline border. While someone is typing in - * it (it has focus and holds text, and the frame carries `data-typing`), it glows in the focus - * color: its border tints, a soft ring of `ring` goes round it and a soft shadow of `ring` sits - * under it. Focus alone is not enough: a conversation keeps the box focused from the moment it - * opens, and a box that always glows is decoration. It is the only thing in the app that glows, - * drawn from `ring` alone, so it has its dark value already. The glow eases in, and with reduced - * motion it simply appears. + * At rest it is a card that sits a little above the page: a hairline ring of `border` round it, + * where a card has its border, and the softest shadow step (`shadow-xs`) under it. Its border is + * kept, transparent, so the glow has a border to tint. While someone is typing in it (it has focus + * and holds text, and the frame carries `data-typing`), it glows in the focus color: its border + * tints, a soft ring of `ring` goes round it and a soft shadow of `ring` sits under it. Focus alone + * is not enough: a conversation keeps the box focused from the moment it opens, and a box that + * always glows is decoration. It is the only thing in the app that glows, drawn from `ring` alone, + * so it has its dark value already. The glow eases in, and with reduced motion it simply appears. + * + * The resting shadow is `shadow-xs` and takes no opacity of its own (no `shadow-lg/5`): the glow's + * `shadow-ring/20` is multiplied by any opacity set at rest, which would all but put it out. */ export const MESSAGE_BOX_FRAME = - "rounded-xl border border-border bg-card transition-[border-color,box-shadow] duration-150 ease-out motion-reduce:transition-none focus-within:data-typing:border-ring/60 focus-within:data-typing:ring-4 focus-within:data-typing:ring-ring/15 focus-within:data-typing:shadow-lg focus-within:data-typing:shadow-ring/20"; + "rounded-xl border border-transparent bg-card shadow-xs ring-1 ring-border transition-[border-color,box-shadow] duration-150 ease-out motion-reduce:transition-none focus-within:data-typing:border-ring/60 focus-within:data-typing:ring-4 focus-within:data-typing:ring-ring/15 focus-within:data-typing:shadow-lg focus-within:data-typing:shadow-ring/20"; diff --git a/app/tests/message-box-frame.test.ts b/app/tests/message-box-frame.test.ts index f5464108b1..976c38bbf0 100644 --- a/app/tests/message-box-frame.test.ts +++ b/app/tests/message-box-frame.test.ts @@ -3,36 +3,36 @@ import { readFileSync } from "node:fs"; import { MESSAGE_BOX_FRAME } from "@/components/channels/composer/frame"; /* - * The message box (docs/app-guidelines.md, "The look"): a flat card at rest, glowing in the focus - * color only while someone types in it. It is the one thing in the app that glows. + * The message box (docs/app-guidelines.md, "The look", rule 8): at rest a card with a hairline ring + * and the softest shadow, glowing in the focus color only while someone types in it. It is the one + * thing in the app that glows. */ const classes = MESSAGE_BOX_FRAME.split(/\s+/).filter(Boolean); describe("the message box's frame", () => { - test("at rest it is a flat hairline card", () => { + test("at rest it is a card with a hairline ring of the line color and the softest shadow", () => { expect(classes).toEqual( - expect.arrayContaining([ - "rounded-xl", - "border", - "border-border", - "bg-card", - ]), + expect.arrayContaining(["rounded-xl", "bg-card", "border"]), ); const atRest = classes.filter((name) => !name.startsWith("focus-within:")); - expect(atRest.filter((name) => /^(shadow|ring)-/.test(name))).toEqual([]); + // The ring is a line like any other, at the one strength every line has. + expect( + atRest.filter((name) => /^(shadow|ring|border)-/.test(name)), + ).toEqual(["border-transparent", "shadow-xs", "ring-1", "ring-border"]); + // No opacity of its own on the resting shadow: the glow's shadow color is multiplied by it. + expect(atRest.some((name) => /^shadow-.*\//.test(name))).toBe(false); }); test("it glows only while someone is typing in it: focus and text", () => { - expect(classes).toEqual( - expect.arrayContaining([ - "focus-within:data-typing:border-ring/60", - "focus-within:data-typing:ring-4", - "focus-within:data-typing:ring-ring/15", - "focus-within:data-typing:shadow-lg", - "focus-within:data-typing:shadow-ring/20", - ]), - ); + // The glow as it was drawn before the resting ring came: exactly these, nothing added. + expect(classes.filter((name) => name.startsWith("focus-within:"))).toEqual([ + "focus-within:data-typing:border-ring/60", + "focus-within:data-typing:ring-4", + "focus-within:data-typing:ring-ring/15", + "focus-within:data-typing:shadow-lg", + "focus-within:data-typing:shadow-ring/20", + ]); // Focus alone does not glow: a conversation keeps the box focused from the moment it opens. const focusOnly = classes.filter( (name) => diff --git a/app/tests/ui-look-guard.test.ts b/app/tests/ui-look-guard.test.ts index 5f58698d0e..f0b798bd2d 100644 --- a/app/tests/ui-look-guard.test.ts +++ b/app/tests/ui-look-guard.test.ts @@ -139,7 +139,8 @@ const NOT_READ = [ "components/ui/", "skins/", "lib/api/generated/", - // The message box's frame (rule 8): part of the look, kept beside the composer that uses it. + // The message box's frame (rule 8): part of the look, kept beside the composer that uses it. Its + // resting ring, its shadow-xs and its glow are held by message-box-frame.test.ts. "components/channels/composer/frame.ts", ]; diff --git a/docs/app-guidelines.md b/docs/app-guidelines.md index 038e7e9e7a..8bb569ce02 100644 --- a/docs/app-guidelines.md +++ b/docs/app-guidelines.md @@ -231,7 +231,7 @@ things are drawn, not how big they are. steps only: - none for everything in the page: the panel, cards, rows, fields, the sidebar; - `shadow-xs` for a control pressed on a surface: an outlined button, a switch's knob, the - chosen tab, a checkbox; + chosen tab, a checkbox. The message box at rest has it too (rule 8); - `shadow-lg` and a border for what opens beside the thing that opened it: menus, selects, popovers, tooltips, toasts; - `shadow-2xl` and a border for what sits over the app: dialogs, the command menu, sheets. @@ -241,8 +241,10 @@ things are drawn, not how big they are. writes no size by hand (`h-[43px]`); it uses the nearest Tailwind step, never a smaller one. 7. **Rows.** One card of rows with hairline dividers (`PageRows`). The leading icon is a 16px glyph in `muted-foreground` on a 32px tile with a hairline ring. -8. **The message box** is a flat card at rest. While someone types in it, it glows in `ring`. It - is the only control that glows. +8. **The message box** at rest is a card with a hairline ring of `border` in place of its border, + and `shadow-xs` under it, so it sits a little above the page. While someone types in it, it + glows in `ring`. It is the only control that glows. The resting shadow takes no opacity of its + own, because the glow's shadow color is multiplied by it. 9. **Icons.** Hugeicons' free set, at their usual sizes, imported from `components/icons` and never from the set itself. The line is the set's own 1.5, which every glyph carries. An icon that needs another line says why in a comment.