import React from 'react'; import { InlineCode } from '~/components/base/code'; import { B, P } from '~/components/base/paragraph'; import { H2, H3Code } from '~/components/plugins/Headings'; import { ConstantDefinitionData, PropsDefinitionData } from '~/components/plugins/api/APIDataTypes'; import APISectionProps from '~/components/plugins/api/APISectionProps'; import { CommentTextBlock, resolveTypeName } from '~/components/plugins/api/APISectionUtils'; export type APISectionComponentsProps = { data: ConstantDefinitionData[]; componentsProps: PropsDefinitionData[]; }; const renderComponent = ( { name, comment, type }: ConstantDefinitionData, componentsProps?: PropsDefinitionData[] ): JSX.Element => (
{name}

Type: {resolveTypeName(type)}

{componentsProps && componentsProps.length ? ( ) : null}
); const APISectionComponents: React.FC = ({ data, componentsProps }) => data?.length ? ( <>

Components

{data.map(component => renderComponent( component, componentsProps.filter(cp => cp.name.includes(component.name)) ) )} ) : null; export default APISectionComponents;