import { Stack, Group, Badge, Title } from '@mantine/core'; import { useMediaQuery } from '@mantine/hooks'; import { VscSymbolConstant, VscSymbolMethod, VscSymbolProperty } from 'react-icons/vsc'; import { MethodList } from './MethodList'; import { ParameterTable } from './ParameterTable'; import { PropertyList } from './PropertyList'; import { Section } from './Section'; import { TSDoc } from './tsdoc/TSDoc'; import type { ApiClassJSON, ApiConstructorJSON, ApiInterfaceJSON } from '~/DocModel/ApiNodeJSONEncoder'; import type { ParameterDocumentation } from '~/util/parse.server'; export function PropertiesSection({ data }: { data: ApiClassJSON['properties'] | ApiInterfaceJSON['properties'] }) { const matches = useMediaQuery('(max-width: 768px)', true, { getInitialValueInEffect: false }); return data.length ? (
} padded dense={matches}>
) : null; } export function MethodsSection({ data }: { data: ApiClassJSON['methods'] | ApiInterfaceJSON['methods'] }) { const matches = useMediaQuery('(max-width: 768px)', true, { getInitialValueInEffect: false }); return data.length ? (
} padded dense={matches}>
) : null; } export function ParametersSection({ data }: { data: ParameterDocumentation[] }) { const matches = useMediaQuery('(max-width: 768px)', true, { getInitialValueInEffect: false }); return data.length ? (
} padded dense={matches}>
) : null; } export function ConstructorSection({ data }: { data: ApiConstructorJSON }) { const matches = useMediaQuery('(max-width: 768px)', true, { getInitialValueInEffect: false }); const getShorthandName = () => `constructor(${data.parameters.reduce((prev, cur, index) => { if (index === 0) { return `${prev}${cur.isOptional ? `${cur.name}?` : cur.name}`; } return `${prev}, ${cur.isOptional ? `${cur.name}?` : cur.name}`; }, '')})`; return data.parameters.length ? (
} padded dense={matches}> {data.deprecated ? ( Deprecated ) : null} {data.protected ? Protected : null} {getShorthandName()} {data.deprecated ? : null} {data.summary ? : null} {data.remarks ? : null} {data.comment ? : null} {data.parameters.length ? : null}
) : null; }