Skip to content

Ship Pattern B dsr.css, expand Pattern A barrel, and document CSS patterns - #630

Merged
flacoman91 merged 2 commits into
mainfrom
rad-dsr-css-cleanup
Jul 29, 2026
Merged

Ship Pattern B dsr.css, expand Pattern A barrel, and document CSS patterns#630
flacoman91 merged 2 commits into
mainfrom
rad-dsr-css-cleanup

Conversation

@flacoman91

@flacoman91 flacoman91 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a thin companion stylesheet export @cfpb/design-system-react/dsr.css for Pattern B apps that already load full Design System CSS and must not also load fat index.css (duplicate DS rules + fonts).
  • Expand the Pattern A ds-components.ts barrel so index.css covers more React-backed DS modules (list, button-group, expandables, search-input, hero, text-introduction, …).
  • Document Pattern A vs Pattern B clearly in the README (what to import, what not to combine).
  • Keep inactive Tabs on isLink / a-btn--link so dotted-underline link chrome stays correct while tab styles live in tab.scss / dsr.css.

Why

Existing CFPB apps already ship full @cfpb/cfpb-design-system CSS. They cannot safely import DSR index.css without duplicating buttons, forms, fonts, etc. Tabs (and other React-only overrides) live in DSR, not in the Design System package — so Pattern B had no clean CSS entry until dsr.css.

What changed

Area Change
package.json exports Add ./dsr.cssdist/dsr.css
Build Second Vite build (vite.dsr-css.config.ts) + cleanup stub script
dsr-styles.ts DSR-authored styles only (Tabs + React overrides); no fonts / no DS molecules
ds-components.ts Broader Pattern A coverage for index.css
README Pattern A / Pattern B / do-not-combine guidance
Tabs Restore Button isLink on inactive tabs for correct link styling

Consumer demos (dsr-test)

Demo Shows
dsr-test#7 Pattern A index.css only — Tabs OK
dsr-test#8 Pattern B broken Full DS CSS, no dsr.css — Tabs incomplete
dsr-test#6 Pattern B fixed Full DS CSS + dsr.css — Tabs fixed

Previews:

Usage

Pattern A (new React apps):

import '@cfpb/design-system-react/index.css'

Pattern B (existing DS apps):

import '@cfpb/design-system-react/dsr.css'
// Do not also import '@cfpb/design-system-react/index.css'

Test plan

Add a thin dist/dsr.css export for existing DS apps that need Tabs and
other React-only styles without loading full index.css. Expand
ds-components.ts so Pattern A covers List, ButtonGroup, expandables,
search-input, hero, and related modules. Render Tab as a native button
so tab chrome no longer fights a-btn--link defaults.
Reverting the native-button rewrite; tab chrome stays in tab.scss while
inactive tabs use a-btn--link (dotted underline) again.
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-29 19:44 UTC

@flacoman91 flacoman91 changed the title css cleanup and restructure Ship Pattern B dsr.css, expand Pattern A barrel, and document CSS patterns Jul 28, 2026
@flacoman91
flacoman91 marked this pull request as ready for review July 29, 2026 18:07
@flacoman91
flacoman91 enabled auto-merge (squash) July 29, 2026 18:07
@flacoman91
flacoman91 requested a review from virginiacc July 29, 2026 19:07
@flacoman91
flacoman91 merged commit 0b15ef0 into main Jul 29, 2026
3 checks passed
@flacoman91
flacoman91 deleted the rad-dsr-css-cleanup branch July 29, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants