mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
fix(website): client-side rendering fallback
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import type { ApiClass, ApiConstructor } from '@microsoft/api-extractor-model';
|
||||
import { ApiItemKind } from '@microsoft/api-extractor-model';
|
||||
import { Outline } from '../Outline';
|
||||
// import { Outline } from '../Outline';
|
||||
import { Documentation } from '../documentation/Documentation';
|
||||
import { HierarchyText } from '../documentation/HierarchyText';
|
||||
import { Members } from '../documentation/Members';
|
||||
import { ObjectHeader } from '../documentation/ObjectHeader';
|
||||
import { ConstructorSection } from '../documentation/section/ConstructorSection';
|
||||
import { TypeParameterSection } from '../documentation/section/TypeParametersSection';
|
||||
import { serializeMembers } from '../documentation/util';
|
||||
// import { serializeMembers } from '../documentation/util';
|
||||
|
||||
export function Class({ clazz }: { clazz: ApiClass }) {
|
||||
const constructor = clazz.members.find((member) => member.kind === ApiItemKind.Constructor) as
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { ApiInterface } from '@microsoft/api-extractor-model';
|
||||
import { Outline } from '../Outline';
|
||||
// import { Outline } from '../Outline';
|
||||
import { Documentation } from '../documentation/Documentation';
|
||||
import { HierarchyText } from '../documentation/HierarchyText';
|
||||
import { Members } from '../documentation/Members';
|
||||
import { ObjectHeader } from '../documentation/ObjectHeader';
|
||||
import { TypeParameterSection } from '../documentation/section/TypeParametersSection';
|
||||
import { serializeMembers } from '../documentation/util';
|
||||
// import { serializeMembers } from '../documentation/util';
|
||||
|
||||
export function Interface({ item }: { item: ApiInterface }) {
|
||||
return (
|
||||
|
||||
@@ -8,6 +8,7 @@ export function TypeAlias({ item }: { item: ApiTypeAlias }) {
|
||||
return (
|
||||
<Documentation>
|
||||
<Header kind={item.kind} name={item.displayName} sourceURL={item.sourceLocation.fileUrl} />
|
||||
{/* @ts-expect-error async component */}
|
||||
<SyntaxHighlighter code={item.excerpt.text} />
|
||||
<SummarySection item={item} />
|
||||
</Documentation>
|
||||
|
||||
@@ -13,6 +13,7 @@ export interface FunctionBodyProps {
|
||||
export function FunctionBody({ item }: { item: ApiFunction }) {
|
||||
return (
|
||||
<Documentation>
|
||||
{/* @ts-expect-error async component */}
|
||||
<SyntaxHighlighter code={item.excerpt.text} />
|
||||
<SummarySection item={item} />
|
||||
{item.typeParameters.length ? <TypeParameterSection item={item} /> : null}
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
import type { ApiMethod, ApiMethodSignature } from '@microsoft/api-extractor-model';
|
||||
import { ApiItemKind } from '@microsoft/api-extractor-model';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { Anchor } from '~/components/Anchor';
|
||||
import { ExcerptText } from '~/components/ExcerptText';
|
||||
|
||||
function getShorthandName(method: ApiMethod | ApiMethodSignature) {
|
||||
return `${method.name}${method.isOptional ? '?' : ''}(${method.parameters.reduce((prev, cur, index) => {
|
||||
if (index === 0) {
|
||||
return `${prev}${cur.isOptional ? `${cur.name}?` : cur.name}`;
|
||||
}
|
||||
|
||||
return `${prev}, ${cur.isOptional ? `${cur.name}?` : cur.name}`;
|
||||
}, '')})`;
|
||||
}
|
||||
|
||||
export function MethodHeader({ method }: { method: ApiMethod | ApiMethodSignature }) {
|
||||
const isDeprecated = Boolean(method.tsdocComment?.deprecatedBlock);
|
||||
|
||||
@@ -12,18 +22,6 @@ export function MethodHeader({ method }: { method: ApiMethod | ApiMethodSignatur
|
||||
[method.displayName, method.overloadIndex],
|
||||
);
|
||||
|
||||
const getShorthandName = useCallback(
|
||||
(method: ApiMethod | ApiMethodSignature) =>
|
||||
`${method.name}${method.isOptional ? '?' : ''}(${method.parameters.reduce((prev, cur, index) => {
|
||||
if (index === 0) {
|
||||
return `${prev}${cur.isOptional ? `${cur.name}?` : cur.name}`;
|
||||
}
|
||||
|
||||
return `${prev}, ${cur.isOptional ? `${cur.name}?` : cur.name}`;
|
||||
}, '')})`,
|
||||
[],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col scroll-mt-30" id={key}>
|
||||
<div className="flex flex-col gap-2 md:-ml-9">
|
||||
|
||||
Reference in New Issue
Block a user