feat(website): show examples on constructors (#10856)

* feat(website): show examples on constructors

* fix: lint

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Qjuh
2025-04-27 02:48:18 +02:00
committed by GitHub
parent a4f3a2574d
commit d32aacd14c
2 changed files with 7 additions and 1 deletions

View File

@@ -2,7 +2,9 @@ import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
import { Code2, LinkIcon } from 'lucide-react';
import Link from 'next/link';
import { ENV } from '@/util/env';
import { ExampleNode } from './ExampleNode';
import { ParameterNode } from './ParameterNode';
import { SeeNode } from './SeeNode';
import { SummaryNode } from './SummaryNode';
export async function ConstructorNode({ node, version }: { readonly node: any; readonly version: string }) {
@@ -44,6 +46,10 @@ export async function ConstructorNode({ node, version }: { readonly node: any; r
<SummaryNode node={node.summary.summarySection} padding version={version} />
) : null}
{node.summary?.exampleBlocks.length ? <ExampleNode node={node.summary.exampleBlocks} version={version} /> : null}
{node.summary?.seeBlocks.length ? <SeeNode node={node.summary.seeBlocks} padding version={version} /> : null}
<div aria-hidden className="p-4">
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
</div>

View File

@@ -93,7 +93,7 @@ export async function DocItem({
<Outline node={node} />
{node.constructor?.parametersString ? <ConstructorNode node={node.constructor} version={version} /> : null}
{node.constructor ? <ConstructorNode node={node.constructor} version={version} /> : null}
{node.typeParameters?.length ? (
<div className="flex flex-col gap-4">