mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-01 16:40:07 +00:00
* fix(ExceptText): don't display import("d..-types/v10"). in return type
* Squashed 'packages/api-extractor-model/' content from commit 39ecb196c
git-subtree-dir: packages/api-extractor-model
git-subtree-split: 39ecb196ca210bdf84ba6c9cadb1bb93571849d7
* Squashed 'packages/api-extractor/' content from commit 341ad6c51
git-subtree-dir: packages/api-extractor
git-subtree-split: 341ad6c51b01656d4f73b74ad4bdb3095f9262c4
* feat(api-extractor): add api-extractor and -model
* fix: package.json docs script
* fix(SourcLink): use <> instead of function syntax
* fix: make packages private
* fix: rest params showing in docs, added labels
* fix: missed two files
* fix: cpy-cli & pnpm-lock
* fix: increase icon size
* fix: icon size again
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { ApiItemKind } from '@discordjs/api-extractor-model';
|
|
import { VscSymbolClass } from '@react-icons/all-files/vsc/VscSymbolClass';
|
|
import { VscSymbolEnum } from '@react-icons/all-files/vsc/VscSymbolEnum';
|
|
import { VscSymbolInterface } from '@react-icons/all-files/vsc/VscSymbolInterface';
|
|
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
|
|
import { VscSymbolVariable } from '@react-icons/all-files/vsc/VscSymbolVariable';
|
|
import type { PropsWithChildren } from 'react';
|
|
import { SourceLink } from './SourceLink';
|
|
|
|
function generateIcon(kind: ApiItemKind) {
|
|
switch (kind) {
|
|
case ApiItemKind.Class:
|
|
return <VscSymbolClass />;
|
|
case ApiItemKind.Function:
|
|
case ApiItemKind.Method:
|
|
return <VscSymbolMethod />;
|
|
case ApiItemKind.Enum:
|
|
return <VscSymbolEnum />;
|
|
case ApiItemKind.Interface:
|
|
return <VscSymbolInterface />;
|
|
case ApiItemKind.TypeAlias:
|
|
case ApiItemKind.Variable:
|
|
return <VscSymbolVariable />;
|
|
default:
|
|
return <VscSymbolMethod />;
|
|
}
|
|
}
|
|
|
|
export function Header({
|
|
kind,
|
|
name,
|
|
sourceURL,
|
|
sourceLine,
|
|
}: PropsWithChildren<{
|
|
readonly kind: ApiItemKind;
|
|
readonly name: string;
|
|
readonly sourceLine?: number | undefined;
|
|
readonly sourceURL?: string | undefined;
|
|
}>) {
|
|
return (
|
|
<div className="flex flex-col">
|
|
<h2 className="flex flex-row place-items-center justify-between gap-2 break-all text-2xl font-bold">
|
|
<span className="row flex flex place-items-center gap-2">
|
|
<span>{generateIcon(kind)}</span>
|
|
{name}
|
|
</span>
|
|
{sourceURL ? <SourceLink sourceLine={sourceLine} sourceURL={sourceURL} /> : null}
|
|
</h2>
|
|
</div>
|
|
);
|
|
}
|