Skip to content

Commit 1067ac4

Browse files
authored
Type on Tailwind's whole-pixel scale: text-sm 14px, text-xs 12px, titles 24px (#2698)
* Type on Tailwind's whole-pixel scale: text-sm 14px, text-xs 12px, titles 24px theme.css set every --text-* step to Tailwind's default times 15/16, so each size was a fraction of a pixel: text-sm 13.125px, text-xs 11.25px, a page title 22.5px. The steps are now Tailwind's own: text-xs 12px, text-sm 14px, text-base 16px, text-2xl 24px. --text-conversation stays as it is. The line under a row's name (ItemDescription) is text-sm in muted-foreground, the name's size, as in shadcn. Three screens that forced it back to text-xs no longer do. Rows with a description are 71px, 6px taller than before. The look's type rule, the layout skill and the comments that stated the old sizes say the new ones. The artifacts kit test reads text-sm from Tailwind's own --text-sm. * Skins test: the update banner's line sits 1px higher on the 14px scale The banner's line is text-sm, centred in its 28px row. At 14px on a 20px line (was 13.125px on 18.75px) its top lands at 10px instead of 11px in OpenDuet and OpenFuse. The banner and its row are where they were, so only the measured baseline changes. * Type scale only; Desktop's setup window on the same scale; docs on how sizes change The line under a row's name (ItemDescription) and the three screens that set it moved to their own pull request, so this one is the type scale alone. A title over a one-line description is 67px on the new scale (was 65px). OpenBot Desktop's setup window had its own copy of the 15/16 scale. It now uses Tailwind's whole-pixel steps too, so setup and the app match. At 16px the Docker Desktop hand-off needs a fifth line at the smallest window (720x560), so the page holds five lines there instead of four. "Sizes stay" in the look and in design-system.md now says how a size changes: only with its scale, for every screen at once, agreed first. * Take main's CHANGELOG.md: the release note moves to the pull request's description * Desktop's first paint draws the setup page's heading at 24px and its line at 16px The cover Windows draws before the setup page loads copies the page's first card, and its test checks styles.css still has the sizes it copied. On the whole-pixel scale the h1 is 24px (was 22.5px) at 1.3 and the lede 16px (was 15px), so the cover now draws them at those sizes.
1 parent cc87bc9 commit 1067ac4

15 files changed

Lines changed: 55 additions & 57 deletions

File tree

‎.claude/skills/openbot-screen-layout/SKILL.md‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ components above; a screen that sets its own is drifting.
7272
| Section heading → description | 4px | `PageSection` |
7373
| Heading block → section content | 16px | `PageRows` / `PageEmpty` (`mt-4`) |
7474
| Controls stacked inside a section | 12px | the screen, with `gap-3` |
75-
| A row in `PageRows` | 65px with a description, never under 56px | `Item` (`px-4 py-3.5 gap-3`), `PageRows` (`min-h-14`) |
75+
| A row in `PageRows` | 67px with a description, never under 56px | `Item` (`px-4 py-3.5 gap-3`), `PageRows` (`min-h-14`) |
7676
| Divider between rows | inset 16px from both edges | `PageRows`, on every horizontal `Separator` inside it |
7777

7878
The 32px under the title is deliberately tighter than the 48px between sections: the title belongs
@@ -204,10 +204,8 @@ Only where the request asks for a dialog (Screens, Not Dialogs).
204204
## Units
205205

206206
The root is the browser's 16px, so Tailwind's spacing, sizes and widths are their documented values
207-
(`p-4` is 16px, `max-w-3xl` is 768px) and land on its 4px grid. Text is the exception: `styles.css`
208-
sets every `--text-*` to Tailwind's default times 15/16, so `text-sm` is 13.125px and body text is
209-
15px. That is the scale this app has always read at; do not size text in px or rem by hand to match
210-
the docs.
207+
(`p-4` is 16px, `max-w-3xl` is 768px) and land on its 4px grid. Text is on Tailwind's own scale
208+
too: `text-xs` is 12px, `text-sm` 14px and body text 16px. Do not size text in px or rem by hand.
211209

212210
Even so, never hardcode a pixel constant derived from a Tailwind token, and never compute a ratio
213211
from one. Measure the element — `offsetWidth`, `clientWidth`, a `ResizeObserver` — and scale from what

‎app/src/components/channels/composer/attachment-strip.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function AttachmentStrip({
131131
* ON THE SIZE LINE, NOT UNDER IT, AND THAT IS A LAYOUT CONSTRAINT RATHER THAN A
132132
* PREFERENCE. The tile's height is fixed so that a file and a thumbnail read as
133133
* one row. A third line does not fit: with three lines the two in-flow children
134-
* need 65px (a 20px icon and three 15px lines) inside a 62px box. Something
134+
* need 68px (a 20px icon and three 16px lines) inside a 62px box. Something
135135
* has to give, and the only choices are the icon shrinking to 17px or the text
136136
* spilling past the border. Folding the warning onto this line keeps two.
137137
*

‎app/src/components/layout/page-parts.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ export function PageRows({
173173
* inside a card of divided rows painted a hover as a floating pill: a middle row has no corners,
174174
* and the first and last cannot be concentric with the card while sitting a border inside it.
175175
*
176-
* Every row is at least 56px, whatever it holds. A title over a description is 65px; a lone
177-
* line would be 48px and look stunted beside it, so it is held up to the floor. A description
176+
* Every row is at least 56px, whatever it holds. A title over a description is 67px; a lone
177+
* line would be 47px and look stunted beside it, so it is held up to the floor. A description
178178
* that wraps to a second line still grows the row rather than being clipped.
179179
*/
180180
<div

‎app/src/components/ui/item.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const itemVariants = cva(
4444
},
4545
/*
4646
* Linear's settings row: 16px in from every edge and 12px between media, text and actions.
47-
* A title over a one-line description comes to 65px, a single line to 48px.
47+
* A title over a one-line description comes to 67px, a single line to 47px.
4848
*/
4949
size: {
5050
default: "gap-3 px-4 py-3.5",

‎app/src/theme.css‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,19 @@ body {
138138
*/
139139

140140
/*
141-
* Text is sized on a 15px base while everything else is on Tailwind's 16px rem.
141+
* Text is on Tailwind's own type scale, in whole pixels.
142142
*
143-
* The root stays at the browser's 16px so spacing, sizes and radii land on Tailwind's 4px grid
144-
* (`p-4` is 16px, `h-8` is 32px). Only type keeps the scale it had under the old 15px root: each
145-
* size below is Tailwind's default multiplied by 15/16, so `text-sm` is still 13.125px. Line
146-
* heights are Tailwind's own unitless ratios and scale with them. `body` reads `--text-base`, so
147-
* unclassed text is 15px too.
143+
* The root is the browser's 16px, and no `--text-*` step is set here, so each one is Tailwind's
144+
* default: `text-xs` is 12px, `text-sm` 14px, `text-base` 16px, `text-lg` 18px, `text-xl` 20px,
145+
* `text-2xl` 24px, `text-3xl` 30px and `text-4xl` 36px, each with Tailwind's line height. `body`
146+
* reads `text-base`, so unclassed text is 16px. Text was once 15/16 of these, which put every
147+
* step on a fraction of a pixel and made it smaller than the same step in shadcn.
148+
*
149+
* `--text-conversation` is ours: the size a conversation's messages are set in.
148150
*/
149151
@theme inline {
150-
--text-xs: 0.703125rem; /* 11.25px */
151-
--text-sm: 0.8203125rem; /* 13.125px */
152-
--text-base: 0.9375rem; /* 15px */
153152
--text-conversation: 1rem;
154153
--text-conversation--line-height: 1.5;
155-
--text-lg: 1.0546875rem; /* 16.875px */
156-
--text-xl: 1.171875rem; /* 18.75px */
157-
--text-2xl: 1.40625rem; /* 22.5px */
158-
--text-3xl: 1.7578125rem; /* 28.125px */
159-
--text-4xl: 2.109375rem; /* 33.75px */
160154
--font-heading: var(--font-sans);
161155
--font-sans: "Figtree Variable", ui-sans-serif, system-ui, sans-serif;
162156
--color-sidebar-ring: var(--sidebar-ring);

‎app/tests/artifacts-kit.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ describe("the artifacts kit", () => {
401401
// Dark under `.dark`, and not inside an artifact drawn in its own light scheme.
402402
/\.dark\\:bg-card:is\(\.dark \*, \[data-color-scheme="dark"\], \[data-color-scheme="dark"\] \*\):not\(\[data-color-scheme="light"\], \[data-color-scheme="light"\] \*\)\s*{\s*background-color: var\(--card\);/,
403403
/\.rounded-lg\s*{\s*border-radius: var\(--radius\);/,
404-
// The app's type scale: 15/16 of Tailwind's.
405-
/\.text-sm\s*{\s*font-size: 0\.8203125rem;/,
404+
// The app's type scale: Tailwind's own, so text-sm is 14px.
405+
/\.text-sm\s*{\s*font-size: var\(--text-sm\);/,
406+
/--text-sm: 0\.875rem;/,
406407
/\.data-open\\:animate-in:where\(\[data-state="open"\]\)/,
407408
// The app's base layer and its text face.
408409
/border-color: var\(--border\);/,

‎app/tests/connect-your-ai.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2254,7 +2254,7 @@ describe.skipIf(!asked)("Connect your AI on OpenBot Cloud", () => {
22542254
expect(room).not.toBeNull();
22552255
// Clear of the fade, and no further: the frame keeps the fade's height above the
22562256
// buttons for every step, so a step adding room of its own doubles the gap. Within a
2257-
// pixel, for the sub-pixel sizes text is drawn at (styles.css scales it by 15/16).
2257+
// pixel, for the sub-pixel line heights of Tailwind's type scale.
22582258
expect(room ?? -2).toBeGreaterThanOrEqual(-1);
22592259
expect(room ?? Number.POSITIVE_INFINITY).toBeLessThanOrEqual(8);
22602260
if (shots) {

‎app/tests/conversation-row-text.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { classes } from "./ui-look-rules";
44

55
/*
66
* A conversation row's second voice (its time, the "Working" label and the preview line) stays at
7-
* the 12px it has always had. text-xs (11.25px) would make it smaller, which the look rules out,
8-
* and text-sm (13.1px) made it the title's size, so the row lost its hierarchy.
7+
* the 12px it has always had. text-sm (14px) made it the title's size, so the row lost its
8+
* hierarchy.
99
*/
1010

1111
const source = readFileSync(

‎app/tests/skins-window-buttons.test.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,11 @@ describe.skipIf(!asked)("the skins and the window's buttons", () => {
493493
"[data-openduet-page] header p": { x: 485, y: 25 },
494494
},
495495
"openduet-pane": { 'button[aria-label="Menu"]': { x: 16, y: 20 } },
496+
// The banner's line is text-sm, centred in its 28px row. On the whole-pixel type scale it
497+
// is 14px on a 20px line (was 13.125px on 18.75px), so its top is 1px higher. The row and
498+
// the banner have not moved.
496499
"openduet-update": {
497-
'[aria-label="OpenBot update"] p': { x: 16, y: 11 },
500+
'[aria-label="OpenBot update"] p': { x: 16, y: 10 },
498501
},
499502
opendots: {
500503
'nav[aria-label="Workspace navigation"] a': { x: 6, y: 16 },
@@ -514,7 +517,7 @@ describe.skipIf(!asked)("the skins and the window's buttons", () => {
514517
'button[aria-label="Open conversations and menu"]': { x: 20, y: 16 },
515518
},
516519
"openfuse-update": {
517-
'[aria-label="OpenBot update"] p': { x: 16, y: 11 },
520+
'[aria-label="OpenBot update"] p': { x: 16, y: 10 },
518521
},
519522
};
520523
const seen: Record<string, Awaited<ReturnType<typeof corner>>> = {};

‎app/tests/ui-look-guard.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ const CLEAN = [
218218
"components/app-sidebar/conversations-panel.tsx",
219219
"components/app-sidebar/bots-panel.tsx",
220220
"components/app-sidebar/channel.tsx",
221-
// Not channel-item-content.tsx: its time, Working label and preview line keep their 12px, which
222-
// no step on this scale draws (text-xs is 11.25px, text-sm 13.1px). They stay on the allowlist
223-
// with that reason, held by conversation-row-text.test.ts.
221+
// Not channel-item-content.tsx: its time, Working label and preview line keep their 12px, written
222+
// by hand from when no step drew 12px. text-xs is 12px now, so they can move to it and come off
223+
// the allowlist. Until then conversation-row-text.test.ts holds them at 12px.
224224
// The message box.
225225
"components/channels/composer/composer.tsx",
226226
// Home, and a Bot's tile on it and on Bots.

0 commit comments

Comments
 (0)