Repository navigation
feat(ui-core): add semantic color prop to Typography - #30665
chirag-madlani merged 1 commit into
Conversation
antd's Typography.Text/Paragraph exposes a `type` prop ("secondary" | "success" | "warning" | "danger") that sets a semantic text color. The antd->ui-core-components migration gap-check found 20 call sites relying on `type="secondary"` with no core equivalent, forcing a per-site `className="tw:text-tertiary"` workaround. This adds a first-class `color` prop to core Typography mapping each antd type to the existing semantic Tailwind text tokens (tw:text-tertiary, tw:text-success-primary, tw:text-warning-primary, tw:text-error-primary), matching the idiom already used elsewhere in core (tree.tsx, pagination.tsx, form-field, empty-placeholder). Omitting the prop leaves current behavior unchanged, and an explicit consumer className still wins over the color class via twMerge ordering.
Fixes #30663
Co-Authored-By: Claude Fable 5 <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ ApprovedAdds a semantic color prop to the Typography component mapped to existing design tokens, supported by comprehensive vitest coverage. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
✅ Playwright Results — workflow succeededValidated commit ✅ 65 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 59m 48s ⏱️ Max setup 1m 28s · max shard execution 7m 22s · max shard-job elapsed before upload 10m 22s · reporting 2s 🌐 146.49 requests/attempt · 1.73 app boots/UI scenario · 0.00% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
08e3c8b
into
antd-migration/core-button-forwardref
Summary
Part of the AntD → ui-core-components migration (Wave 1 prep, epic #30570). Stacked on #30664 (reuses its vitest infra); base auto-retargets to main when that merges.
antd Typography's
typeprop (semantic text color) has no core equivalent — the Typography sweep's gap check found 20 livetype="secondary"call sites whose only migration target today is a per-site hardcoded className. This adds a first-class prop so the sweep gets a 1:1 mapping, and covers the remaining antd values for future use.color?: 'secondary' | 'success' | 'warning' | 'danger'mapped to existing semantic tokens (no invented names — each verified in current core usage):tw:text-tertiarytw:text-success-primarytw:text-warning-primarytw:text-error-primaryOmitted prop → behavior unchanged. Consumer
classNamecomposes and can still override (twMerge precedence, documented inline).Tests
7 new vitest cases (one per value, omitted-prop no-op, className composition) — written failing first, now green; full package suite 11/11.
Fixes #30663
🤖 Generated with Claude Code
Greptile Summary
Adds semantic text-color support to the ui-core Typography component.
colorprop mapping secondary, success, warning, and danger values to existing Tailwind utilities.classNameprecedence throughcx.Confidence Score: 5/5
The PR appears safe to merge, with no concrete behavioral, compatibility, or security defects identified.
The semantic values map to fixed existing utility classes, omitted color preserves prior behavior, consumer classes retain precedence, and focused tests cover the new API behavior.
Important Files Changed
Reviews (1): Last reviewed commit: "feat(ui-core): add semantic color prop t..." | Re-trigger Greptile