My Jetpack: migrate link-variant Buttons to @wordpress/ui Link#49109
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
The .primary-footer flex container previously relied on its <button> children sharing intrinsic heights for visual centering. Migrating the secondary "Learn more" from jetpack-components Button(variant=link) to @wordpress/ui Link (a plain <a>) broke that implicit centering — the Link text dropped to baseline alongside the primary Upgrade button. Adds an explicit `align-items: center` so the cross-axis alignment is no longer dependent on child element type.
…ui (#49111) Migrates two remaining @automattic/jetpack-components Button consumers in projects/packages/my-jetpack/_inc/components/product-interstitial-modal/: - product-interstitial-modal-cta.tsx: Upgrade CTA Button migrated to @wordpress/ui Button with variant="solid". When an href is provided, renders an anchor via the render={<a />} + nativeButton={false} pattern established in PR #48489. isLoading -> loading. The styles['action-button'] className was a no-op (no .action-button rule in the SCSS module) and has been dropped. - product-interstitial-my-jetpack.tsx: inline AI fair-usage-policy 'Learn more about it here' Button (variant="link") migrated to @wordpress/ui Link with openInNewTab, following the L1b sweep recipe in PR #49109. Refs #48160.
Refs #48160
Proposed changes
Sweep
@automattic/jetpack-componentsButton variant="link"usages inpackages/my-jetpackand migrate them to@wordpress/uiLink. Continues the migration tracked in issue #48160 and follows the cross-cuttingExternalLink→Linkprecedent set by #48529.Six call sites across two files were migrated. The Plans Section file already had
Linkimported from@wordpress/ui(the "Manage your plan" link in the same<ul>), so the new sites adopt a treatment already in production on the same screen.BEFORE:
AFTER:
Sites migrated
_inc/components/plans-section/index.tsxButton href isExternalLink variant="link" weight="regular"Link href openInNewTab(Renew subscription)_inc/components/plans-section/index.tsxButton href isExternalLink variant="link" weight="regular"Link href openInNewTab(Resume subscription)_inc/components/plans-section/index.tsxButton onClick href variant="link" weight="regular"Link onClick href(View included features)_inc/components/plans-section/index.tsxButton onClick href isExternalLink variant="link" weight="regular"Link onClick href openInNewTab(Purchase a plan)_inc/components/plans-section/index.tsxButton onClick href variant="link" weight="regular"Link onClick href(Activate a license)_inc/components/product-interstitial-modal/product-interstitial-modal.tsxButton variant="link" isExternalLink hrefLink openInNewTab href(Learn more)plans-section/index.tsxno longer importsButtonfrom@automattic/jetpack-components.product-interstitial-modal.tsxkeeps itsButtonimport because the modal-trigger<Button variant={ modalTriggerButtonVariant }>(primary/secondary) is out of scope for this slice.Prop mapping (
jetpack-componentsButton →@wordpress/uiLink)hrefhrefisExternalLink={ true }openInNewTabgutenberg/packages/ui/src/link/link.tsx:openInNewTabsetstarget="_blank"and appends an aria-labelled new-tab icon.variant="link"@wordpress/uiLink is link-styled by default (variant="default",tone="brand").weight="regular"@wordpress/uiLink does not expose a weight prop. Inherits the surrounding text weight, matching the existing already-migratedLinkat the top of the same<ul>inplans-section.childrenchildrenonClickonClickLinkProps extends ComponentProps<'a'>.Sites NOT migrated (intentional)
_inc/components/connection-status-card/index.tsx:178Buttonis imported from@wordpress/components, not@automattic/jetpack-components— out of scope for this slice._inc/components/product-interstitial-modal/product-interstitial-my-jetpack.tsx:154_inc/components/golden-token/tooltip/index.tsx:48Related product discussion/links
@wordpress/componentsExternalLink →@wordpress/uiLink)jetpack-components-migrationledger)Does this pull request change what data or activity we track or use?
No.
onClickhandlers preserve the existing analytics events (jetpack_myjetpack_plans_manage_click,_view_included_features_click,_plans_purchase_click,_activate_license_click).Testing instructions
target="_blank"on the anchor).secondaryButtonHasExternalLinkdefaults totrue.Gating note
Per #48529,
@wordpress/uiLink still has a style-parity gap with@wordpress/componentsExternalLink that is tracked upstream as gutenberg#77790. If reviewers spot any visual regressions stemming from that same gap, this PR may need to wait for the upstream fix — same as #48529. The component swap here is mechanically equivalent to what #48529 already shipped, so the parity story should be identical.