feat(v2): add icon to external footer links (#5092)

This commit is contained in:
Alexey Pyltsyn 2021-06-30 11:54:26 +03:00 committed by GitHub
parent e5916dc596
commit 1cecd78f25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,8 +11,10 @@ import clsx from 'clsx';
import Link from '@docusaurus/Link';
import {FooterLinkItem, useThemeConfig} from '@docusaurus/theme-common';
import useBaseUrl from '@docusaurus/useBaseUrl';
import isInternalUrl from '@docusaurus/isInternalUrl';
import styles from './styles.module.css';
import ThemedImage, {Props as ThemedImageProps} from '@theme/ThemedImage';
import IconExternalLink from '@theme/IconExternalLink';
function FooterLink({
to,
@ -35,7 +37,14 @@ function FooterLink({
to: toUrl,
})}
{...props}>
{label}
{href && !isInternalUrl(href) ? (
<span>
{label}
<IconExternalLink />
</span>
) : (
label
)}
</Link>
);
}