refactor: docs design (#8487)

This commit is contained in:
Noel
2022-08-15 14:48:00 +02:00
committed by GitHub
parent d09ef1e425
commit 4ab1d09997
44 changed files with 1533 additions and 1251 deletions

View File

@@ -1,10 +1,7 @@
import { Anchor, Text } from '@mantine/core';
import Link from 'next/link';
import type { TokenDocumentation } from '~/util/parse.server';
export interface HyperlinkedTextProps {
tokens: TokenDocumentation[];
}
/**
* Constructs a hyperlinked html node based on token type references
*
@@ -12,22 +9,24 @@ export interface HyperlinkedTextProps {
*
* @returns An array of JSX elements and string comprising the hyperlinked text
*/
export function HyperlinkedText({ tokens }: HyperlinkedTextProps) {
export function HyperlinkedText({ tokens }: { tokens: TokenDocumentation[] }) {
return (
<>
{tokens.map((token) => {
{tokens.map((token, idx) => {
if (token.path) {
return (
<Link key={token.text} href={token.path}>
<a className="text-blue-500 dark:text-blue-300 no-underline">{token.text}</a>
<Link key={idx} href={token.path} passHref>
<Anchor component="a" inherit>
{token.text}
</Anchor>
</Link>
);
}
return (
<span key={token.text} className="text-blue-500 dark:text-blue-300">
<Text key={idx} span unstyled>
{token.text}
</span>
</Text>
);
})}
</>