From 7df078f5edeff499869df340a90b60b23e8bf3ca Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Mon, 13 Jul 2026 13:00:40 +0200 Subject: [PATCH] fix(legal): wrap the privacy table's first column, top-align cells The shared legal-page template inherited the offer's shrink-to-fit product-name column (width:1% + white-space:nowrap), which stopped the privacy data table's long prose first column from wrapping and blew the table out horizontally. Scope that rule to the offer (body.offer) and top-align all legal-table cells for the multi-line privacy rows. --- ui/src/lib/offer.test.ts | 10 ++++++++++ ui/src/lib/offer.ts | 16 ++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ui/src/lib/offer.test.ts b/ui/src/lib/offer.test.ts index c606a78..0e7fd58 100644 --- a/ui/src/lib/offer.test.ts +++ b/ui/src/lib/offer.test.ts @@ -39,4 +39,14 @@ describe('renderLegalHtml', () => { expect(html).toContain('Публичная оферта — Эрудит'); expect(html).toContain('href="https://erudit-game.ru/offer/"'); }); + + it('scopes the shrink-to-fit first-column table rule to the offer only', () => { + // The offer opts into the nowrap product-name column via body.offer; other legal pages (the + // privacy data table) must NOT get it, or their prose first column cannot wrap. + expect(renderOfferHtml('# x')).toContain(''); + const generic = renderLegalHtml('# x', { title: 't', canonical: 'c' }); + expect(generic).toContain(''); + expect(generic).not.toContain(' @@ -94,11 +94,14 @@ export function renderLegalHtml(markdown: string, opts: { title: string; canonic td { border: 1px solid var(--cell-border); padding: 6px 10px; + /* Top-align: the privacy data table's prose cells differ in height per row. */ + vertical-align: top; } - /* The product-name column shrinks to its content and never wraps; the price columns share the - rest of the width (width:1% is the shrink-to-fit idiom paired with the table's width:100%). */ - th:first-child, - td:first-child { + /* Offer only: the product-name column shrinks to its content and never wraps; the price columns + share the rest of the width (width:1% is the shrink-to-fit idiom paired with width:100%). Other + legal tables (the privacy data table) keep the default auto layout so their prose cells wrap. */ + .offer th:first-child, + .offer td:first-child { width: 1%; white-space: nowrap; } @@ -110,7 +113,7 @@ export function renderLegalHtml(markdown: string, opts: { title: string; canonic } - +
${body}
@@ -127,5 +130,6 @@ export function renderOfferHtml(markdown: string): string { return renderLegalHtml(markdown, { title: 'Публичная оферта — Эрудит', canonical: 'https://erudit-game.ru/offer/', + bodyClass: 'offer', }); }