Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Replace link-style `Button` components and bare `<a>` tags with `Link` from `@wordpress/ui` in integrations, the responses modal, and response inspector mailto/tel links. Open Akismet-related URLs in a new tab only in the block editor so the dashboard keeps navigation in the same tab.
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ const IntegrationCardComponent = ( {
<VStack spacing="3">
<p style={ { color: '#50575e', margin: 0 } }>{ message }</p>
<HStack spacing="2" justify="start">
<Button variant="link" href={ settingsUrl } target="_blank" rel="noopener noreferrer">
<Link openInNewTab href={ settingsUrl }>
{ __( 'View settings', 'jetpack-forms' ) }
</Button>
</Link>
{ id === 'akismet' && (
<>
<span>|</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,21 @@ export function buildAkismetCard( {
'Akismet is active. There is one step left. Please add your <a>Akismet key</a>.',
'jetpack-forms'
),
{ a: <Link openInNewTab href={ settingsUrl } children={ null } /> }
{
a: (
<Link
openInNewTab={ context === 'block-editor' }
href={ settingsUrl }
children={ null }
/>
),
}
) }
</p>
<Button
variant="secondary"
href={ settingsUrl }
target="_blank"
target={ context === 'block-editor' ? '_blank' : '_self' }
rel="noopener noreferrer"
__next40pxDefaultSize={ true }
>
Expand All @@ -76,20 +84,18 @@ export function buildAkismetCard( {
</p>
<HStack spacing="2" justify="start" className="integration-card__links">
{ context === 'dashboard' && handlers?.goToSpam ? (
<Button variant="link" onClick={ handlers.goToSpam }>
{ __( 'View spam', 'jetpack-forms' ) }
</Button>
<Link onClick={ handlers.goToSpam }>{ __( 'View spam', 'jetpack-forms' ) }</Link>
) : (
<Button variant="link" href={ spamUrl } target="_blank" rel="noopener noreferrer">
<Link openInNewTab={ context === 'block-editor' } href={ spamUrl }>
{ __( 'View spam', 'jetpack-forms' ) }
</Button>
</Link>
) }
<span>|</span>
{ settingsUrl && (
<>
<Button variant="link" href={ settingsUrl } target="_blank" rel="noopener noreferrer">
<Link openInNewTab={ context === 'block-editor' } href={ settingsUrl }>
{ __( 'View stats and settings', 'jetpack-forms' ) }
</Button>
</Link>
<span>|</span>
</>
) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Button, __experimentalHStack as HStack } from '@wordpress/components'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import { __ } from '@wordpress/i18n';
import { Link } from '@wordpress/ui';
import GoogleSheetsIcon from '../../../../../icons/google-sheets.tsx';
import GoogleDriveConnectButton from '../components/google-drive-connect-button.tsx';
import GoogleDriveDisconnectButton from '../components/google-drive-disconnect-button.tsx';
Expand Down Expand Up @@ -60,9 +61,9 @@ export function buildGoogleDriveCard( {
{ __( 'View form responses', 'jetpack-forms' ) }
</Button>
) : (
<Button variant="link" href={ responsesUrl } target="_blank" rel="noopener noreferrer">
<Link openInNewTab href={ responsesUrl }>
{ __( 'View form responses', 'jetpack-forms' ) }
</Button>
</Link>
) }
<span>|</span>
<GoogleDriveDisconnectButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,7 @@ export function buildJetpackCrmCard( {
'jetpack-forms'
),
{
a: (
<Button
variant="link"
href={ settingsUrl }
target="_blank"
rel="noopener noreferrer"
/>
),
a: <Link openInNewTab href={ settingsUrl } />,
}
) }
</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
__experimentalHStack as HStack, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/components';
import { Link } from '@wordpress/ui';
import CopyClipboardButton from '../../../copy-clipboard-button';
import './style.scss';

Expand All @@ -14,10 +15,10 @@ const FieldEmail = ( { email } ) => {
justify="left"
spacing="2"
>
<a href={ `mailto:${ email }` }>
<Link href={ `mailto:${ email }` }>
{ emailParts[ 0 ] }
<wbr />@{ emailParts[ 1 ] }
</a>
</Link>
<CopyClipboardButton text={ email } />
</HStack>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { useEffect, useState } from '@wordpress/element';
import { Link } from '@wordpress/ui';
/**
* Internal dependencies
*/
Expand Down Expand Up @@ -65,7 +66,7 @@ const FieldPhone = ( { phone }: FieldPhoneProps ) => {

return (
<TextWithFlag countryCode={ countryCode }>
<a href={ `tel:${ phone }` }>{ formattedNumber }</a>
<Link href={ `tel:${ phone }` }>{ formattedNumber }</Link>
</TextWithFlag>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Internal dependencies
*/
import { Link } from '@wordpress/ui';
import clsx from 'clsx';
import {
isFieldsCollection,
Expand Down Expand Up @@ -56,7 +57,7 @@ const ResponseFieldsIterator = ( {
}

if ( isLikelyPhoneNumber( value ) ) {
return <a href={ `tel:${ value }` }>{ String( value ) }</a>;
return <Link href={ `tel:${ value }` }>{ String( value ) }</Link>;
}

return value as import('react').ReactNode;
Expand Down
Loading