fix(website): client-side rendering fallback

This commit is contained in:
iCrawl
2023-04-13 23:29:26 +02:00
parent 88cab1a0ec
commit e4c5f794b0
14 changed files with 41 additions and 41 deletions

View File

@@ -1,13 +1,13 @@
import type { ApiDeclaredItem, ApiItemContainerMixin, ApiTypeParameterListMixin } from '@microsoft/api-extractor-model';
import type { ReactNode } from 'react';
import { Outline } from '../Outline';
// import { Outline } from '../Outline';
import { SyntaxHighlighter } from '../SyntaxHighlighter';
import { Documentation } from './Documentation';
import { MethodsSection } from './section/MethodsSection';
import { PropertiesSection } from './section/PropertiesSection';
import { SummarySection } from './section/SummarySection';
import { TypeParameterSection } from './section/TypeParametersSection';
import { hasProperties, hasMethods, serializeMembers } from './util';
import { hasProperties, hasMethods /* , serializeMembers */ } from './util';
export function MemberContainerDocumentation({
item,
@@ -19,6 +19,7 @@ export function MemberContainerDocumentation({
return (
<Documentation>
{subheading}
{/* @ts-expect-error async component */}
<SyntaxHighlighter code={item.excerpt.text} />
<SummarySection item={item} />
{item.typeParameters.length ? <TypeParameterSection item={item} /> : null}

View File

@@ -11,6 +11,7 @@ export function ObjectHeader({ item }: ObjectHeaderProps) {
return (
<>
<Header kind={item.kind} name={item.displayName} sourceURL={item.sourceLocation.fileUrl} />
{/* @ts-expect-error async component */}
<SyntaxHighlighter code={item.excerpt.text} />
<SummarySection item={item} />
</>

View File

@@ -1,23 +1,20 @@
import type { ApiConstructor } from '@microsoft/api-extractor-model';
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
import { useCallback } from 'react';
import { ParameterTable } from '../../ParameterTable';
import { TSDoc } from '../tsdoc/TSDoc';
import { DocumentationSection } from './DocumentationSection';
function getShorthandName(ctor: ApiConstructor) {
return `constructor(${ctor.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 ConstructorSection({ item }: { item: ApiConstructor }) {
const getShorthandName = useCallback(
(ctor: ApiConstructor) =>
`constructor(${ctor.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 (
<DocumentationSection icon={<VscSymbolMethod size={20} />} padded title="Constructor">
<div className="flex flex-col gap-2">