From da6de92e8c05b8481fa87bc5bcfa8929577f848e Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Sun, 7 May 2023 15:22:05 +0100 Subject: [PATCH] feat(DocsLink): Support overriding text (#9525) --- apps/guide/src/components/DocsLink.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/guide/src/components/DocsLink.tsx b/apps/guide/src/components/DocsLink.tsx index 57ce04fa2..658f5d8f9 100644 --- a/apps/guide/src/components/DocsLink.tsx +++ b/apps/guide/src/components/DocsLink.tsx @@ -1,4 +1,5 @@ import { FiExternalLink } from '@react-icons/all-files/fi/FiExternalLink'; +import type { PropsWithChildren } from 'react'; import { BASE_URL, BASE_URL_LEGACY, PACKAGES, VERSION } from '~/util/constants'; interface DocsLinkOptions { @@ -50,7 +51,8 @@ export function DocsLink({ symbol, brackets, static: staticReference, -}: DocsLinkOptions) { + children, +}: PropsWithChildren) { // In the case of no type and no parent, this will default to the entry point of the respective documentation. let url = docs === PACKAGES[0] ? `${BASE_URL_LEGACY}/${VERSION}/general/welcome` : `${BASE_URL}/${docs}/stable`; let text = `${docs === PACKAGES[0] ? '' : '@discordjs/'}${docs}`; @@ -77,7 +79,7 @@ export function DocsLink({ return ( - {text} + {children ?? text} );