mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
feat: table of contents / method visibility / property modifiers
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Group, Stack, Title } from '@mantine/core';
|
||||
import { Badge, Group, Stack, Title } from '@mantine/core';
|
||||
import { HyperlinkedText } from './HyperlinkedText';
|
||||
import { ParameterTable } from './ParameterTable';
|
||||
import { TSDoc } from './tsdoc/TSDoc';
|
||||
import type { DocMethod } from '~/DocModel/DocMethod';
|
||||
import type { DocMethodSignature } from '~/DocModel/DocMethodSignature';
|
||||
import { Visibility } from '~/DocModel/Visibility';
|
||||
|
||||
type MethodResolvable = ReturnType<DocMethod['toJSON']> | ReturnType<DocMethodSignature['toJSON']>;
|
||||
|
||||
@@ -18,11 +19,21 @@ function getShorthandName(data: MethodResolvable) {
|
||||
}
|
||||
|
||||
export function MethodItem({ data }: { data: MethodResolvable }) {
|
||||
const method = data as ReturnType<DocMethod['toJSON']>;
|
||||
|
||||
return (
|
||||
<Stack spacing="xs">
|
||||
<Stack
|
||||
id={`${data.name}${data.overloadIndex && data.overloadIndex > 1 ? `:${data.overloadIndex}` : ''}`}
|
||||
className="scroll-mt-30"
|
||||
spacing="xs"
|
||||
>
|
||||
<Group>
|
||||
<Stack>
|
||||
<Group>
|
||||
{data.kind === 'Method' && method.visibility === Visibility.Protected ? (
|
||||
<Badge variant="filled">Protected</Badge>
|
||||
) : null}
|
||||
{data.kind === 'Method' && method.static ? <Badge variant="filled">Static</Badge> : null}
|
||||
<Title order={4} className="font-mono break-all">{`${getShorthandName(data)}`}</Title>
|
||||
<Title order={4}>:</Title>
|
||||
<Title order={4} className="font-mono break-all">
|
||||
|
||||
Reference in New Issue
Block a user