diff --git a/packages/components/src/external-link/index.tsx b/packages/components/src/external-link/index.tsx index 0927effb3ae672..3002d3a506b242 100644 --- a/packages/components/src/external-link/index.tsx +++ b/packages/components/src/external-link/index.tsx @@ -8,13 +8,14 @@ import type { ForwardedRef } from 'react'; * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { forwardRef } from '@wordpress/element'; +import { Fragment, forwardRef } from '@wordpress/element'; /** * Internal dependencies */ import type { ExternalLinkProps } from './types'; import type { WordPressComponentProps } from '../context'; +import { Suffix } from '../input-control/styles/input-control-styles'; function UnforwardedExternalLink( props: Omit< @@ -23,7 +24,14 @@ function UnforwardedExternalLink( >, ref: ForwardedRef< HTMLAnchorElement > ) { - const { href, children, className, rel = '', ...additionalProps } = props; + const { + href, + children, + className, + rel = '', + suffix, + ...additionalProps + } = props; const optimizedRel = [ ...new Set( [ @@ -54,28 +62,33 @@ function UnforwardedExternalLink( return ( /* eslint-disable react/jsx-no-target-blank */ - - - { children } - - - ↗ - - + +
+ + + { children } + + + ↗ + + +
{ suffix && { suffix } }
+
+
/* eslint-enable react/jsx-no-target-blank */ ); } diff --git a/packages/components/src/external-link/types.ts b/packages/components/src/external-link/types.ts index a2b5cfb8324ced..9043686a33df49 100644 --- a/packages/components/src/external-link/types.ts +++ b/packages/components/src/external-link/types.ts @@ -12,4 +12,9 @@ export type ExternalLinkProps = { * The URL of the external resource. */ href: string; + /** + * Allows for markup other than icons or shortcuts to be added to the menu item. + * + */ + suffix?: ReactNode; }; diff --git a/packages/editor/src/components/post-url/index.js b/packages/editor/src/components/post-url/index.js index c2b2ac8826b205..14afcc5be65518 100644 --- a/packages/editor/src/components/post-url/index.js +++ b/packages/editor/src/components/post-url/index.js @@ -102,13 +102,6 @@ export default function PostURL( { onClose } ) { / } - suffix={ -