Repository navigation
refactor(switch): remove legacy components and any legacy styles - FE-7888 - #8339
DipperTheDan wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the Switch hint-text migration.
No open issues 🎉
1 file not reviewed
skills/carbon-react/components/switch.md: Excluded by your content exclusion settings
What changed in this PR
Updates Switch to use the current internal hint-text component instead of the legacy version.
Changes:
- Applies size-aware typography, disabled styling, and spacing to supporting text.
- Adds unit coverage and a focused-hints visual story.
- Documents deprecated props and migration behavior.
| File | Description |
|---|---|
| src/components/switch/switch.test.tsx | Tests hint styling, fallback behavior, and accessible descriptions. |
| src/components/switch/switch.style.tsx | Adds styled hint wrappers with spacing. |
| src/components/switch/switch.mdx | Documents deprecated props and replacements. |
| src/components/switch/switch.component.tsx | Replaces legacy hints with current styled components. |
| src/components/switch/switch-test.stories.tsx | Adds focused switches with hints in both sizes. |
Review effort: Balanced
|
nitpick (non-blocking): Since the Might be worth deleting them while you're here but it's totally fine to leave for a follow-up though since most of the other helpers in the file aren't used either. |
ibutakova
left a comment
There was a problem hiding this comment.
Everything looks good! I just have a quick question about the tests. Since jsdom doesn't actually render CSS, these assertions are only checking the code itself rather than what the browser paints - meaning a test would still pass even if a token is undefined in the theme. Given that this is already visually covered by the new chromatic story, do we still need these style assertions?
No, I’ll drop the new |
Proposed behaviour
Removes legacy hint text in favour of the current version of the component.
Current behaviour
Component still uses the legacy version of hint text.
Checklist
d.tsfile added or updated if requiredQA
Additional context
Testing instructions
There should be no functional or visual regressions with Switch.