mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-12-15 05:53:52 +01:00
32 lines
955 B
JavaScript
32 lines
955 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
import React from 'react';
|
|
import Link from '@docusaurus/Link';
|
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
export default function FooterLinkItem({item}) {
|
|
const {to, href, label, prependBaseUrlToHref, ...props} = item;
|
|
const toUrl = useBaseUrl(to);
|
|
const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
|
|
return (
|
|
<Link
|
|
className="footer__link-item"
|
|
{...(href
|
|
? {
|
|
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
}
|
|
: {
|
|
to: toUrl,
|
|
})}
|
|
{...props}>
|
|
{label}
|
|
{href && !isInternalUrl(href) && <IconExternalLink />}
|
|
</Link>
|
|
);
|
|
}
|