import React from 'react'; import ReactMarkdown from 'react-markdown'; import { InlineCode } from '~/components/base/code'; import { B } from '~/components/base/paragraph'; import { H2, H3Code } from '~/components/plugins/Headings'; import { InterfaceDefinitionData, InterfaceValueData } from '~/components/plugins/api/APIDataTypes'; import { CommentTextBlock, mdInlineRenderers, resolveTypeName, STYLES_OPTIONAL, } from '~/components/plugins/api/APISectionUtils'; export type APISectionInterfacesProps = { data: InterfaceDefinitionData[]; }; const renderInterfacePropertyRow = ({ name, flags, type, comment, }: InterfaceValueData): JSX.Element => ( {name} {flags?.isOptional ? ( <>
(optional) ) : null} {resolveTypeName(type)} {comment?.shortText ? ( {comment.shortText} ) : ( '-' )} ); const renderInterface = ({ name, children, comment }: InterfaceDefinitionData): JSX.Element => (
{name} {children.map(renderInterfacePropertyRow)}
Name Type Description
); const APISectionInterfaces: React.FC = ({ data }) => data?.length ? ( <>

Interfaces

{data.map(renderInterface)} ) : null; export default APISectionInterfaces;