refactor: docs (#10126)

This commit is contained in:
Noel
2024-02-29 04:37:52 +01:00
committed by GitHub
parent 0f9017ef95
commit 18cce83d80
192 changed files with 8116 additions and 6321 deletions

View File

@@ -0,0 +1,44 @@
export function resolveNodeKind(kind: string) {
switch (kind) {
case 'Class':
return {
text: 'text-green-500',
background: 'bg-green-500/20',
};
case 'Interface':
return {
text: 'text-amber-500',
background: 'bg-amber-500/20',
};
case 'Function':
return {
text: 'text-blue-500',
background: 'bg-blue-500/20',
};
case 'Enum':
return {
text: 'text-rose-500',
background: 'bg-rose-500/20',
};
case 'TypeAlias':
return {
text: 'text-pink-500',
background: 'bg-pink-500/20',
};
case 'Variable':
return {
text: 'text-purple-500',
background: 'bg-purple-500/20',
};
default:
return {
text: 'text-gray-500',
background: 'bg-gray-500/20',
};
}
}
export async function DocKind({ background = false, node }: { readonly background?: boolean; readonly node: any }) {
const kind = resolveNodeKind(node.kind);
return <span className={background ? `${kind.background} ${kind.text}` : kind.text}>{node.kind.toLowerCase()}</span>;
}