mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
feat(website): add extends clauses, enum members and automatic -types links (#8270)
* feat(website): add extends clauses, enum members and automatic -types links * chore: remove vscode settings * refactor: remove util file
This commit is contained in:
30
packages/website/src/components/HyperlinkedText.tsx
Normal file
30
packages/website/src/components/HyperlinkedText.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user