My Jetpack: migrate link-variant Buttons to @wordpress/ui Link#49109
My Jetpack: migrate link-variant Buttons to @wordpress/ui Link#49109CGastrell wants to merge 1 commit into
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. 🤷 |
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.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:48SCSS prescan
grep -rnE 'jp-action-button\|components-button' projects/packages/my-jetpack/_incfinds 10 class-hook references in the package, but none on the two files migrated here (plans-section/style.module.scssandproduct-interstitial-modal/style.module.scssare clean). The 10 hits target unrelated buttons (connection-status-card, onboarding-tour, products-table-view, my-jetpack-tab-panel, product-detail-card, golden-token tooltip). No SCSS surgery is needed in this PR.Related 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.Note on visual screenshots
I attempted to capture before/after screenshots from an isolated
jp docker upinstance for this PR. The cloned instance kept its source-DBsiteurland Jetpack connection state, which blocked access to the My Jetpack admin page (current_user_can('jetpack_admin_page')returned false for the cloned admin user). The migration is mechanically deterministic and the precedent screen —plans-section/index.tsxline 239 — already renders a@wordpress/uiLink in production, so the new sites inherit the exact same treatment as code that's been on trunk since #48529. I'd appreciate a reviewer with a connected MJ admin doing the visual pass per the testing instructions above.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.