import { renderMethod } from './APISectionMethods';
import { APIDataType } from '~/components/plugins/api/APIDataType';
import {
CommentData,
InterfaceDefinitionData,
MethodSignatureData,
PropData,
} from '~/components/plugins/api/APIDataTypes';
import { APISectionDeprecationNote } from '~/components/plugins/api/APISectionDeprecationNote';
import { APISectionPlatformTags } from '~/components/plugins/api/APISectionPlatformTags';
import {
CommentTextBlock,
getTagData,
parseCommentContent,
renderFlags,
renderParamRow,
ParamsTableHeadRow,
resolveTypeName,
renderDefaultValue,
STYLES_APIBOX,
getTagNamesList,
STYLES_APIBOX_NESTED,
ELEMENT_SPACING,
H3Code,
getCommentContent,
BoxSectionHeader,
} from '~/components/plugins/api/APISectionUtils';
import { Cell, Row, Table } from '~/ui/components/Table';
import { H2, BOLD, P, CODE, DEMI, MONOSPACE } from '~/ui/components/Text';
export type APISectionInterfacesProps = {
data: InterfaceDefinitionData[];
};
const renderInterfaceComment = (
comment?: CommentData,
signatures?: MethodSignatureData[],
defaultValue?: string
) => {
if (signatures && signatures.length) {
const { type, parameters, comment: signatureComment } = signatures[0];
const defaultTag = getTagData('default', signatureComment);
const initValue =
defaultValue || (defaultTag ? getCommentContent(defaultTag.content) : undefined);
return (
<>
{parameters?.length ? parameters.map(param => renderParamRow(param)) : null}
{resolveTypeName(type)}
{signatureComment && (
<>
{resolveTypeName(extendedType)}
))}