Skip to content

Replace hardcoded hex palettes in RepayModal and RequestEvaluation with design tokens #164

@greatest0fallt1me

Description

@greatest0fallt1me

Description

The README states one-off hex values are a "review-blocker" and that color should come from the design tokens in src/utils/tokens.ts and the :root custom properties in src/index.css. Two large surfaces violate this: src/components/RepayModal.tsx and src/pages/RequestEvaluation.tsx each define a local const COLOR = { bg: '#0d1117', surface: '#161b22', border: '#30363d', text: '#e6edf3', muted: '#8b949e', accent: '#58a6ff', success: '#3fb950', warning: '#d29922', danger: '#f85149' } block plus extensive inline style={{ ... }} usage. This issue removes those private palettes and routes both components through the shared token source.

Requirements and context

  • Replace the local COLOR objects in src/components/RepayModal.tsx and src/pages/RequestEvaluation.tsx with the canonical tokens from src/utils/tokens.ts (and/or the :root CSS variables in src/index.css).
  • Where token names are missing, add them to src/utils/tokens.ts rather than introducing new hex literals — the token catalogue is documented in docs/DESIGN_SYSTEM.md.
  • Prefer moving heavy inline style blocks into CSS that references the :root custom properties, consistent with how src/pages/CreditLines.tsx and src/pages/Dashboard.tsx already consume COLOR/UTIL_COLOR from tokens.
  • Preserve the exact current visual appearance (same colors, same severity-to-color mapping for info/success/warning/danger).
  • Non-functional: no raw #rrggbb literals may remain in these two files after the change; keep strict TypeScript happy.

Acceptance criteria

  • No hardcoded hex literals remain in RepayModal.tsx or RequestEvaluation.tsx.
  • Colors resolve from src/utils/tokens.ts and/or src/index.css :root variables.
  • Any newly needed colors are added as named tokens, not inline hex.
  • The rendered appearance is visually unchanged (before/after screenshots in the PR).
  • docs/DESIGN_SYSTEM.md token catalogue is updated if tokens were added.
  • Existing tests still pass and a test asserts a token-driven class/variable is applied.

Suggested execution

1. Fork the repo and create a branchgit checkout -b feature/tokenize-repay-and-evaluation.
2. Implement changes — delete the COLOR blocks, reference shared tokens, extract inline styles to CSS using :root variables; extend src/utils/tokens.ts as needed.
3. Write/extend tests — Vitest + @testing-library/react; assert token-backed styling hooks (class names or CSS variables) rather than literal hex.
4. Test and commit

npm install
npm test -- --run
npm run build

Example commit message

refactor(tokens): remove hardcoded hex from RepayModal and RequestEvaluation

Guidelines

  • ≥90% coverage on any logic touched; visual parity is the primary bar.
  • Maintain WCAG AA contrast — tokens must preserve the documented contrast ratios.
  • Keep docs/DESIGN_SYSTEM.md authoritative for the token list.
  • Timeframe: 96 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions