DX-1128: localise presentational components (Badge/Button/LinkButton/FeaturedLink/Status)#3412
DX-1128: localise presentational components (Badge/Button/LinkButton/FeaturedLink/Status)#3412jamiehenson wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4c74691 to
8b2ecc6
Compare
ef72e03 to
02d982a
Compare
8b2ecc6 to
5d78500
Compare
02d982a to
a74f1b6
Compare
5d78500 to
7e2f701
Compare
a74f1b6 to
e801746
Compare
7e2f701 to
0fa1f37
Compare
e801746 to
cee3a61
Compare
0fa1f37 to
52d51ca
Compare
cee3a61 to
88c9b9f
Compare
52d51ca to
6803b67
Compare
88c9b9f to
32bc1f7
Compare
32bc1f7 to
2f29be3
Compare
2f29be3 to
d9f00ba
Compare
…Button/FeaturedLink/Status) (DX-1128) Vendor Badge, Button, LinkButton, FeaturedLink and Status locally, off @ably/ui/core. Their icon props (leftIcon/rightIcon, iconBefore/iconAfter) now take a ReactNode rather than an icon name string: callers pass a Heroicon component or an Ably glyph <Icon> directly, and the component sizes it via a slot. This drops the name->component indirection so Heroicons tree-shake, and matches the glyphs-only local Icon. Also fixes a 'noopenner' rel typo in FeaturedLink and points Footer's (feature-flagged) feedback icons at Heroicons.
d9f00ba to
9d02706
Compare
b724bbf to
6c83436
Compare
There was a problem hiding this comment.
Reviewed against the @ably/ui source. Faithful vendoring — component diffs are entirely prettier/quote-style + import rewiring, no logic drift.
The icon-name→ReactNode flip is done right: the slot reapplies per-size dimensions (lg/md 1.5rem, sm 1.25rem, xs 1rem) matching the old [&>svg]:!w-6/5/4 button-base rules, and !w-full/!h-full overrides a glyph <Icon>'s own inline size. Traced the undefined-size path too (size ?? 'md' → w-6 = 24px ≡ new md = 1.5rem). Sizing preserved exactly. noopener typo fixed; Status/FeaturedLink internal heroicons sized to match (size-4 = 16px, calc(...) unchanged). All migrated-component call sites pass elements; no leftover @ably/ui/core/{Badge,Button,...} imports.
Approving. Two non-blocking notes inline.
~ 𝒢𝓁𝒶𝓊𝒹𝑒
| * (e.g. `<PlusIcon />`) or an Ably glyph (`<Icon name="icon-tech-…" />`) unsized — the | ||
| * button sizes it. | ||
| */ | ||
| leftIcon?: ReactNode; |
There was a problem hiding this comment.
Heads-up for #3413, not this PR. Widening these to ReactNode means a stray icon-name string still typechecks (string ⊆ ReactNode) and renders as literal text in the slot rather than erroring. ExamplesRenderer.tsx:166 still passes leftIcon={icon-tech-${languageKey}} — fine today because that's SegmentedControl (still @ably/ui), but the same string lands in a vendored component the moment #3413 rewires SegmentedControl. Worth catching when you migrate it.
~ 𝒢𝓁𝒶𝓊𝒹𝑒
| xs: '1rem', | ||
| }; | ||
|
|
||
| const iconSlot = (icon: ReactNode, size: ButtonSize, iconColor?: ColorClass | ColorThemeSet) => ( |
There was a problem hiding this comment.
nitpick: this slot span (inline-flex shrink-0 [&>svg]:!w-full [&>svg]:!h-full + inline w/h + colour class) is duplicated almost verbatim in Badge.tsx (iconBefore/iconAfter). Could lift to a shared IconSlot helper so the sizing convention lives in one place. Non-blocking.
~ 𝒢𝓁𝒶𝓊𝒹𝑒
Part of DX-1128. Localises the presentational components docs uses from
@ably/ui.What
Vendored into
src/components/ui/(rewired to local Icon/cn/colors):Badge,Button,LinkButton,FeaturedLink,Status, pluscolors.tsand the Ably logo SVG.swrpromoted to a direct dep.Icon props (
leftIcon/rightIcon,iconBefore/iconAfter) now take aReactNoderather than an icon-name string: callers pass a Heroicon element or an Ably<Icon>glyph directly, and the component sizes it via a slot (preserving each component's original icon size). Internal Heroicon usages (Status, FeaturedLink, plus Footer's flag-gated feedback icons) are converted to direct@heroicons/reactimports. Also fixes anoopenner→noopenerrel typo inFeaturedLink.Behaviour
No visual change intended.
Stack (DX-1128)
@ably/uitokens + reset/core CSS (merged)cn+heightsutilsIconcomponent (Ably glyphs only; Heroicons imported directly)@ably/uiTailwind scan#3410–#3416 are a linear stack, each building on the previous; #3409 has merged to
main. ▶ = this PR.Testing
🤖 Generated with Claude Code