mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-05 21:27:24 +02:00
feat(v2): add icon to external footer links (#5092)
This commit is contained in:
parent
e5916dc596
commit
1cecd78f25
1 changed files with 10 additions and 1 deletions
|
@ -11,8 +11,10 @@ import clsx from 'clsx';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import {FooterLinkItem, useThemeConfig} from '@docusaurus/theme-common';
|
import {FooterLinkItem, useThemeConfig} from '@docusaurus/theme-common';
|
||||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||||
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
import ThemedImage, {Props as ThemedImageProps} from '@theme/ThemedImage';
|
import ThemedImage, {Props as ThemedImageProps} from '@theme/ThemedImage';
|
||||||
|
import IconExternalLink from '@theme/IconExternalLink';
|
||||||
|
|
||||||
function FooterLink({
|
function FooterLink({
|
||||||
to,
|
to,
|
||||||
|
@ -35,7 +37,14 @@ function FooterLink({
|
||||||
to: toUrl,
|
to: toUrl,
|
||||||
})}
|
})}
|
||||||
{...props}>
|
{...props}>
|
||||||
|
{href && !isInternalUrl(href) ? (
|
||||||
|
<span>
|
||||||
{label}
|
{label}
|
||||||
|
<IconExternalLink />
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
label
|
||||||
|
)}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue