mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-04 18:10:08 +00:00
* feat(website): add extends clauses, enum members and automatic -types links * chore: remove vscode settings * refactor: remove util file
31 lines
653 B
TypeScript
31 lines
653 B
TypeScript
import type { TokenDocumentation } from '~/util/parse.server';
|
|
|
|
export interface HyperlinkedTextProps {
|
|
tokens: TokenDocumentation[];
|
|
}
|
|
|
|
/**
|
|
* Constructs a hyperlinked html node based on token type references
|
|
*
|
|
* @param tokens An array of documentation tokens to construct the HTML
|
|
*
|
|
* @returns An array of JSX elements and string comprising the hyperlinked text
|
|
*/
|
|
export function HyperlinkedText({ tokens }: HyperlinkedTextProps) {
|
|
return (
|
|
<>
|
|
{tokens.map((token) => {
|
|
if (token.path) {
|
|
return (
|
|
<a key={token.text} href={token.path}>
|
|
{token.text}
|
|
</a>
|
|
);
|
|
}
|
|
|
|
return token.text;
|
|
})}
|
|
</>
|
|
);
|
|
}
|