mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
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:
@@ -2,7 +2,9 @@ import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
|
|||||||
import { Code2, LinkIcon } from 'lucide-react';
|
import { Code2, LinkIcon } from 'lucide-react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { ENV } from '@/util/env';
|
import { ENV } from '@/util/env';
|
||||||
|
import { ExampleNode } from './ExampleNode';
|
||||||
import { ParameterNode } from './ParameterNode';
|
import { ParameterNode } from './ParameterNode';
|
||||||
|
import { SeeNode } from './SeeNode';
|
||||||
import { SummaryNode } from './SummaryNode';
|
import { SummaryNode } from './SummaryNode';
|
||||||
|
|
||||||
export async function ConstructorNode({ node, version }: { readonly node: any; readonly version: string }) {
|
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} />
|
<SummaryNode node={node.summary.summarySection} padding version={version} />
|
||||||
) : null}
|
) : 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 aria-hidden className="p-4">
|
||||||
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
<div className="h-[2px] bg-neutral-300 dark:bg-neutral-700" role="separator" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export async function DocItem({
|
|||||||
|
|
||||||
<Outline node={node} />
|
<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 ? (
|
{node.typeParameters?.length ? (
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user