Skip to content

FRD: Fix ADR-030 Violations in Legal Components

FieldValue
IDFRD-040
OwnerDavid Holmes
StatusComplete ✅
Last Updated2026-05-26
Target Releasev2.1.0
TypeRefactor
ComplexityS

Document Summary

Five inline style={{}} declarations in legal-proposed-order.tsx and legal-section-cover-page.tsx violate ADR-030, which mandates that all legal-document presentational styles live in legal-document.css. This FRD defines the work to extract those inline styles into CSS class rules, eliminating the violations and restoring a single source of truth for legal-document appearance.


Introduction

Overview

ADR-030 establishes that legal-document.css is the single source of truth for all legal-document styling. No legal component may use inline style={{}} for visual mechanics. This rule exists so that screen rendering and print output stay identical, and so that legal style changes propagate from one file. Five call sites currently violate this rule.

Goals

  • Remove all inline style={{}} from legal-proposed-order.tsx and legal-section-cover-page.tsx.
  • Add equivalent CSS class rules to legal-document.css.
  • Verify that screen and print rendering remain pixel-identical before and after the change.

Non-Goals

  • Redesigning legal component layout or spacing.
  • Changing any visual appearance of legal documents.
  • Auditing other components for ADR-030 compliance (covered by broader compliance tracking).

Scope

In Scope

ItemDescription
legal-proposed-order.tsx line 257Inline style={{ marginTop: '2.5em' }} on the signature block wrapper.
legal-section-cover-page.tsx line 89Inline style={{ on the outer section wrapper.
legal-section-cover-page.tsx line 165Inline style={{ margin: '0 auto' }} on CoverImage.
legal-section-cover-page.tsx line 188Inline style={{ margin: '0 auto 16pt' }} on inline CoverImage.
legal-section-cover-page.tsx line 231Inline style={{ margin: '0 auto' }} on bottom CoverImage.
legal-document.cssNew class rules for extracted styles.

Out of Scope

ItemReason
Other legal componentsThis FRD targets only the identified violations.
Print stylesheet changesADR-030 ensures screen equals print; the CSS classes will inherit print behavior from the existing cascade.
Design token additionsThe values being extracted are fixed spacing values, not new tokens.

Users and Pain Points

UserPain Point
Legal component maintainerCannot reason about legal styles from legal-document.css alone because some styles are scattered as inline declarations.
Print/PDF authorInline styles may not behave identically across print engines, risking screen/print divergence.
ADR compliance reviewerMust flag these violations in every audit, creating recurring noise.

Definitions

TermDefinition
ADR-030Architecture Decision Record mandating that all legal-document styles live in legal-document.css with no inline style={{}}.
Inline styleA React style={{}} prop that applies CSS directly to an element, bypassing the stylesheet cascade.
legal-document.cssThe canonical stylesheet for all legal-document rendering, located at src/components/patterns/myfreelawyer/components/legal-document.css.

Current State

The following inline styles exist in violation of ADR-030:

  1. legal-proposed-order.tsx:257style={{ marginTop: '2.5em' }} adds spacing above the proposed-order signature block.
  2. legal-section-cover-page.tsx:89style={{ applies conditional layout to the section wrapper (flex direction, gap).
  3. legal-section-cover-page.tsx:165style={{ margin: '0 auto' }} centers a CoverImage in the header area.
  4. legal-section-cover-page.tsx:188style={{ margin: '0 auto 16pt' }} centers an inline CoverImage with bottom spacing.
  5. legal-section-cover-page.tsx:231style={{ margin: '0 auto' }} centers a CoverImage in the footer area.

These violations were identified in the ADR compliance report and tracked as tech debt item #81.


Proposed Solution

For each violation:

  1. Define a descriptive CSS class in legal-document.css (e.g., .legal-proposed-order__signature-spacer, .legal-cover-page__image--centered).
  2. Replace the inline style={{}} prop with the new className.
  3. For the conditional layout in legal-section-cover-page.tsx:89, use a modifier class (e.g., .legal-cover-page__section--inline-images) toggled via className rather than a conditional style prop.

All new classes follow the existing BEM-like naming convention in legal-document.css.


Requirements

IDPriorityRequirement
ADR023-01P0Remove inline style={{}} from legal-proposed-order.tsx line 257 and replace with a CSS class.
ADR023-02P0Remove inline style={{}} from legal-section-cover-page.tsx lines 89, 165, 188, 231 and replace with CSS classes.
ADR023-03P0New CSS classes added to legal-document.css produce identical rendering to the inline styles they replace.
ADR023-04P0No visual regression in legal document Storybook stories.

Functional Requirements

  1. The proposed-order signature block retains its 2.5em top margin via the new class .legal-proposed-order__signature-spacer.
  2. Cover-page images remain horizontally centered via .legal-cover-page__image--centered with margin: 0 auto.
  3. Inline cover-page images retain their 16pt bottom margin via .legal-cover-page__image--centered-spaced.
  4. The conditional flex layout on the cover-page section wrapper uses a .legal-cover-page__section--inline-images modifier class that applies display: flex; align-items: center; gap: 32px.
  5. The conditional flex: 1 on the title block uses .legal-cover-page__title-block--flex.

Non-Functional Requirements

CategoryRequirement
Zero visual changeBefore-and-after screenshots of all affected stories must be pixel-identical.
CSS specificityNew classes use the same specificity level as existing legal-document.css rules. No !important.
Print parityScreen and print rendering remain identical per ADR-030.

API/Interface Requirements

No public API changes. The component props remain unchanged; only internal className usage changes.


Accessibility Requirements

No accessibility impact. This is a pure refactor of style application mechanism with zero DOM or semantic changes.


Content and Documentation Requirements

  • Update the ADR compliance report to mark these violations as resolved.
  • No new documentation needed; the class names are internal implementation details documented by their position in legal-document.css.

Dependencies

DependencyTypeNotes
legal-document.cssInternalTarget file for new class rules.
legal-proposed-order.tsxInternalSource of violation #1.
legal-section-cover-page.tsxInternalSource of violations #2 through #5.
ADR-030GovernanceThe rule being enforced.

Risks and Tradeoffs

RiskLikelihoodImpactMitigation
CSS specificity conflict causes unintended override.LowMediumNew classes follow the existing BEM naming and sit at the same specificity tier. Visual regression test catches mismatches.
Conditional class toggling is less readable than conditional style.LowLowThe modifier-class pattern is already used elsewhere in legal-document.css and is the established convention.

Open Questions

  1. Should the cover-page image centering classes be consolidated into a single utility class with a spacing modifier, or kept as separate classes? Leaning toward separate classes for clarity.

Acceptance Criteria

  • Zero inline style={{}} declarations remain in legal-proposed-order.tsx.
  • Zero inline style={{}} declarations remain in legal-section-cover-page.tsx.
  • All extracted styles exist as named classes in legal-document.css.
  • Storybook visual regression snapshots show no pixel differences.
  • pnpm typecheck passes.
  • pnpm vitest run --project unit passes.
  • pnpm build-storybook completes without errors.

LLM Handoff Instructions

When implementing this FRD:

  1. Open src/components/patterns/myfreelawyer/components/legal-document.css and add the new classes at the end of the relevant section (proposed-order styles near other .legal-proposed-order__* rules, cover-page styles near other .legal-cover-page__* rules).
  2. In legal-proposed-order.tsx at line 257, replace style={{ marginTop: '2.5em' }} with className="legal-proposed-order__signature-spacer".
  3. In legal-section-cover-page.tsx, replace each inline style with the corresponding class. For the conditional layout at line 89, use a ternary or clsx to toggle the modifier class.
  4. Check that no other inline style props exist in either file by searching for style={{.
  5. Run pnpm typecheck and pnpm vitest run --project unit.
  6. Run pnpm build-storybook to confirm no build regressions.
  7. Visually inspect the legal document stories in Storybook to confirm identical rendering.

Decision Log

DateDecisionRationale
2026-05-26Extract inline styles to CSS classes rather than CSS custom properties.The values are fixed spacing, not design tokens. Classes match the existing pattern in legal-document.css.
2026-05-26Use BEM modifier classes for conditional layout.Consistent with existing cover-page class naming. Avoids runtime style computation.

Document History

VersionDateAuthorChanges
0.12026-05-26David HolmesInitial draft.