Skip to content
Myr

Review fixes for 1201

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- A diff's deletion bar keeps its dashes: the four line-background overrides (--diffs-bg-{addition,deletion}[-number]-override) are gone. Pierre read the deletion one, unmixed, as the light half of the bar's dashed pattern, so setting it to the sign colour made the bar solid and a deletion told apart from an addition by colour alone. Pierre now mixes each line from the sign colour through its own fallback, so the tints are unchanged. - A README's h2 is on the type scale (text-title, as the h1, which keeps its rule) in place of an arbitrary 17 px. - Tests: tokens.test.ts asserts the line-background overrides stay unset and checks the emphasis overrides for the diff tints; markdown.test.tsx asserts the prose classes carry no arbitrary text size (red before the fix).

authored by oscabriel · committed by oscabriel · parent 60f862e · Browse files · 4 files+34 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+34 added−10 removed

  • tests:+25 added−2 removed
  • other:+9 added−8 removed

4 files+34 added−10 removed

modified:apps/web/src/features/markdown/markdown.tsx+3 added-2 removed
modified:apps/web/src/styles.css+6 added-6 removed
393 unmodified lines
394 --diffs-token-comment: var(--syntax-comment);395 --diffs-token-punctuation: var(--syntax-punctuation);396 --diffs-token-link: var(--syntax-link);397398 /* A diff's lines, in its own tints (Pierre mixes the line's from the399 sign, as --diff-add-bg says). */398 /* A diff's lines, in its own tints. Pierre mixes a changed line's399 background (and its number's) from the sign colour, as --diff-add-bg400 says, so the line backgrounds take no override of their own: Pierre401 also draws a deletion's bar in dashes of that background and the402 sign, and an override set to the sign would make the bar solid, so a403 deletion would differ from an addition by colour alone. */404 --diffs-addition-color-override: var(--diff-add-sign);401 --diffs-bg-addition-override: var(--diff-add-sign);402 --diffs-bg-addition-number-override: var(--diff-add-sign);405 --diffs-bg-addition-emphasis-override: var(--diff-add-emphasis);406 --diffs-deletion-color-override: var(--diff-del-sign);405 --diffs-bg-deletion-override: var(--diff-del-sign);406 --diffs-bg-deletion-number-override: var(--diff-del-sign);407 --diffs-bg-deletion-emphasis-override: var(--diff-del-emphasis);408 --diffs-modified-color-override: var(--muted);409 }410
68 unmodified lines
modified:apps/web/test/markdown.test.tsx+6 added
313 unmodified lines
314 it("sets its h1 at the title size, under the page's own headline", () => {315 expect(proseClasses().has("prose-h1:text-title")).toBeTruthy();316 });317318 it("sizes every element from the type scale, never an arbitrary size", () => {319 expect(320 [...proseClasses()].filter((name) => /(?:^|:)text-\[/u.test(name))321 ).toStrictEqual([]);322 });323324 it("colours it from the tokens, so both schemes come from one set of classes", () => {325 const classes = proseClasses();326327 expect(classes.has("prose-tokens")).toBeTruthy();
22 unmodified lines
modified:apps/web/test/tokens.test.ts+19 added-2 removed
277 unmodified lines
278279 const elsewhere = [280 "diffs-addition-color-override",281 "diffs-deletion-color-override",282 "diffs-bg-addition-override",283 "diffs-bg-deletion-override",282 "diffs-bg-addition-emphasis-override",283 "diffs-bg-deletion-emphasis-override",284 ].filter(285 (name) => !/^var\(--diff-(?:add|del)-/u.test(mapped.get(name) ?? "")286 );287
9 unmodified lines
297 "diffs-bg-selection-override",298 ]);299 });300301 // Pierre reads --diffs-bg-deletion-override both as the colour it mixes a302 // line from and, unmixed, as the light half of a deletion bar's dashes:303 // set it, and the bar turns solid, telling a deletion from an addition by304 // colour alone. Left unset, the line is mixed from the sign colour.305 it("leave a changed line's background to Pierre's mix, so a deletion's bar keeps its dashes", () => {306 const mapped = declarations(diffs);307308 expect(309 [310 "diffs-bg-addition-override",311 "diffs-bg-addition-number-override",312 "diffs-bg-deletion-override",313 "diffs-bg-deletion-number-override",314 ].filter((name) => mapped.has(name))315 ).toStrictEqual([]);316 });317318 it("mark a file tree's changes in the diff tints, and spend no state colour", () => {319 const mapped = declarations(trees);320321 expect(mapped.get("trees-git-added-color-override")).toBe(
69 unmodified lines