refactor(notice,banner,toast): DLT-3296 decouple CSS and fix specificity violations#1194
refactor(notice,banner,toast): DLT-3296 decouple CSS and fix specificity violations#1194Francis Rupert (francisrupert) wants to merge 1 commit intonextfrom
Conversation
|
Please add either the |
WalkthroughRefactored notice-based components (banner, notice, toast) to parameterize layout styling via CSS variables instead of fixed nested selectors. Moved flex display properties to dedicated rules and made margins, gaps, and alignment values configurable across components. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/dialtone-css/lib/build/less/components/notice.less`:
- Around line 55-59: The CSS change alters cascade-driven layout and truncation
by introducing/using CSS vars (--notice-content-direction, --notice-content-gap,
--notice-content-align) and an align-self: center rule that affects
notice/banner/toast; add automated coverage: create visual-regression
(screenshot) tests and a unit/style snapshot test for the notice, banner and
toast components that assert layout/flow and truncation under different var
values and fallbacks (including tests that set --notice-content-direction to
row/column, override --notice-content-gap, and confirm align-self behavior), and
include test cases covering the other edited blocks referenced (lines ~69-73,
~86-88, ~188-197) so the cross-component behavior is validated before merge.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 982d7995-aacf-4aa9-82dd-3b8c89488183
📒 Files selected for processing (3)
packages/dialtone-css/lib/build/less/components/banner.lesspackages/dialtone-css/lib/build/less/components/notice.lesspackages/dialtone-css/lib/build/less/components/toast.less
|
✔️ Deploy previews ready! |
🛠️ Type Of Change
📖 Jira Ticket
DLT-3296
📖 Description
Decouple CSS for notice, banner, and toast. Replace cross-component descendant selectors with CSS custom property inheritance. Fix specificity violations.
What changed:
.d-banner &overrides).d-notice__*children via descendant selectors:where()display: flex/align-items: startmoved from shared rule to.d-noticeindividual rule1pxin banner.less replaced withvar(--dt-size-border-100).d-notice__messagefont override in banner.less removedWhat did NOT change:
💡 Context
notice.less had
.d-banner &overrides baked into notice child selectors — notice knew about its consumers. banner.less and toast.less reached into notice's children via descendant selectors, inflating specificity to (0,2,0). The truncate modifier hit (0,4,0). Coupling ran in both directions, making all three files fragile to changes in the others.The fix extends the custom property inheritance pattern already used for colors (e.g.
--notice-color-background) to also cover spacing, direction, and alignment overrides. Each file now owns only its own styles.📝 Checklist
For all PRs:
For all CSS changes: