mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03: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 { SyntaxHighlighter } from '../../SyntaxHighlighter';
|
||||
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 {
|
||||
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,
|
||||
);
|
||||
|
||||
const defaultValueBlock = comment.customBlocks.find(
|
||||
(block) => block.blockTag.tagName.toUpperCase() === StandardTags.defaultValue.tagNameWithUpperCase,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col space-y-2">
|
||||
{comment.deprecatedBlock ? (
|
||||
@@ -91,6 +95,9 @@ export function TSDoc({ item, tsdoc }: { item: ApiItem; tsdoc: DocNode }): JSX.E
|
||||
) : null}
|
||||
{comment.summarySection ? createNode(comment.summarySection) : null}
|
||||
{comment.remarksBlock ? <RemarksBlock>{createNode(comment.remarksBlock.content)}</RemarksBlock> : null}
|
||||
{defaultValueBlock ? (
|
||||
<DefaultValueBlock>{createNode(defaultValueBlock.content)}</DefaultValueBlock>
|
||||
) : null}
|
||||
{exampleBlocks.length
|
||||
? exampleBlocks.map((block, idx) => <ExampleBlock key={idx}>{createNode(block.content)}</ExampleBlock>)
|
||||
: null}
|
||||
|
||||
Reference in New Issue
Block a user