From 0d93ede752071390109a7c9b0b548188c1c78909 Mon Sep 17 00:00:00 2001 From: Carla Goncalves Date: Tue, 28 Mar 2023 10:38:57 +0100 Subject: [PATCH 1/6] Add external icon svg --- src/components/link.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/link.tsx b/src/components/link.tsx index 40c750461f..b02fe01fa1 100644 --- a/src/components/link.tsx +++ b/src/components/link.tsx @@ -17,8 +17,21 @@ const Link = ({ ...props }: LinkProps & React.ReactNode) => !to || isAbsoluteUrl(to) ? ( - + {props.children} + + + ) : ( Date: Tue, 28 Mar 2023 11:51:47 +0100 Subject: [PATCH 2/6] mend --- src/components/link.tsx | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/link.tsx b/src/components/link.tsx index b02fe01fa1..7959ecf8a7 100644 --- a/src/components/link.tsx +++ b/src/components/link.tsx @@ -19,19 +19,21 @@ const Link = ({ !to || isAbsoluteUrl(to) ? ( {props.children} - - - + {to && isAbsoluteUrl(to) && ( + + + + )} ) : ( Date: Wed, 29 Mar 2023 10:38:48 +0100 Subject: [PATCH 3/6] Add custom a element to mdx provider --- src/components/header.tsx | 6 +++--- src/components/link.tsx | 13 +++++++------ src/components/pageBottom.tsx | 2 +- src/components/parentTitleComp.tsx | 2 +- src/components/search/hitComps.tsx | 2 +- src/components/shortcodes/index.tsx | 3 ++- src/components/shortcodes/subSections.tsx | 2 +- src/components/sidebar/treeNode.tsx | 2 +- src/pages/index.tsx | 18 +++++++++--------- 9 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/components/header.tsx b/src/components/header.tsx index 9668d102d9..748e23192c 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -256,7 +256,7 @@ const MenuItem = ({ componentToShow, type, text, link }: MenuItemProps) => { {showExpanded && componentToShow} ) : ( - +
{text} @@ -308,7 +308,7 @@ const HeaderSec = ({ headerProps }: HeaderViewProps) => { return ( {
{externalLinkItems.map((item) => ( - + {item.text}    diff --git a/src/components/link.tsx b/src/components/link.tsx index 7959ecf8a7..6de7cac54f 100644 --- a/src/components/link.tsx +++ b/src/components/link.tsx @@ -3,26 +3,27 @@ import { Link as GatsbyLink } from 'gatsby' import isAbsoluteUrl from 'is-absolute-url' interface LinkProps { - to: string | null + href: string | null activeClassName?: string partiallyActive?: string getProps?: any } const Link = ({ - to, + href, activeClassName, partiallyActive, getProps, ...props }: LinkProps & React.ReactNode) => - !to || isAbsoluteUrl(to) ? ( - + !href || isAbsoluteUrl(href) ? ( + {props.children} - {to && isAbsoluteUrl(to) && ( + {href && isAbsoluteUrl(href) && ( ) : ( { {editDocsPath && ( - + Edit this page on GitHub )} diff --git a/src/components/parentTitleComp.tsx b/src/components/parentTitleComp.tsx index fce6baf768..8f7c1d2238 100644 --- a/src/components/parentTitleComp.tsx +++ b/src/components/parentTitleComp.tsx @@ -39,7 +39,7 @@ const ParentTitle = ({ slug, nonLink }: ParentTitleProps) => { {parentTitle.map((part: any, index: number) => ( {part.link && !nonLink ? ( - + {part.title} ) : ( diff --git a/src/components/search/hitComps.tsx b/src/components/search/hitComps.tsx index c235e185b8..8f8d688c98 100644 --- a/src/components/search/hitComps.tsx +++ b/src/components/search/hitComps.tsx @@ -56,7 +56,7 @@ const HitComp = styled.div` const DocHit = ({ hit, selected }: any) => hit._distinctSeqID == 0 ? ( - +

/{' '} diff --git a/src/components/shortcodes/index.tsx b/src/components/shortcodes/index.tsx index 2dd69171b2..ef4b577e48 100644 --- a/src/components/shortcodes/index.tsx +++ b/src/components/shortcodes/index.tsx @@ -16,6 +16,7 @@ import Admonition from './admonition' import Quiz from './quiz' import Tip from './tip' import NavigationLinksContainer from './navigationLinksContainer' +import Link from '../link' const shortcodes = { h1: () =>

, @@ -23,7 +24,7 @@ const shortcodes = { h3: ({ id, ...props }: any) =>

, h4: ({ id, ...props }: any) =>

, a: ({ href, ...props }: any) => ( - + ), p: (props: any) =>

, ul: (props: any) =>