mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 05:23:31 +01:00
feat: Support @defaultValue (#9363)
This commit is contained in:
@@ -6,7 +6,7 @@ import { Fragment, useCallback, type ReactNode } from 'react';
|
|||||||
import { ItemLink } from '../../ItemLink';
|
import { ItemLink } from '../../ItemLink';
|
||||||
import { SyntaxHighlighter } from '../../SyntaxHighlighter';
|
import { SyntaxHighlighter } from '../../SyntaxHighlighter';
|
||||||
import { resolveItemURI } from '../util';
|
import { resolveItemURI } from '../util';
|
||||||
import { DeprecatedBlock, ExampleBlock, RemarksBlock, SeeBlock } from './BlockComment';
|
import { DefaultValueBlock, DeprecatedBlock, ExampleBlock, RemarksBlock, SeeBlock } from './BlockComment';
|
||||||
|
|
||||||
export function TSDoc({ item, tsdoc }: { item: ApiItem; tsdoc: DocNode }): JSX.Element {
|
export function TSDoc({ item, tsdoc }: { item: ApiItem; tsdoc: DocNode }): JSX.Element {
|
||||||
const createNode = useCallback(
|
const createNode = useCallback(
|
||||||
@@ -84,6 +84,10 @@ export function TSDoc({ item, tsdoc }: { item: ApiItem; tsdoc: DocNode }): JSX.E
|
|||||||
(block) => block.blockTag.tagName.toUpperCase() === StandardTags.example.tagNameWithUpperCase,
|
(block) => block.blockTag.tagName.toUpperCase() === StandardTags.example.tagNameWithUpperCase,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const defaultValueBlock = comment.customBlocks.find(
|
||||||
|
(block) => block.blockTag.tagName.toUpperCase() === StandardTags.defaultValue.tagNameWithUpperCase,
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col space-y-2">
|
<div className="flex flex-col space-y-2">
|
||||||
{comment.deprecatedBlock ? (
|
{comment.deprecatedBlock ? (
|
||||||
@@ -91,6 +95,9 @@ export function TSDoc({ item, tsdoc }: { item: ApiItem; tsdoc: DocNode }): JSX.E
|
|||||||
) : null}
|
) : null}
|
||||||
{comment.summarySection ? createNode(comment.summarySection) : null}
|
{comment.summarySection ? createNode(comment.summarySection) : null}
|
||||||
{comment.remarksBlock ? <RemarksBlock>{createNode(comment.remarksBlock.content)}</RemarksBlock> : null}
|
{comment.remarksBlock ? <RemarksBlock>{createNode(comment.remarksBlock.content)}</RemarksBlock> : null}
|
||||||
|
{defaultValueBlock ? (
|
||||||
|
<DefaultValueBlock>{createNode(defaultValueBlock.content)}</DefaultValueBlock>
|
||||||
|
) : null}
|
||||||
{exampleBlocks.length
|
{exampleBlocks.length
|
||||||
? exampleBlocks.map((block, idx) => <ExampleBlock key={idx}>{createNode(block.content)}</ExampleBlock>)
|
? exampleBlocks.map((block, idx) => <ExampleBlock key={idx}>{createNode(block.content)}</ExampleBlock>)
|
||||||
: null}
|
: null}
|
||||||
|
|||||||
Reference in New Issue
Block a user