From e147c5bd64fc9ba233d7eaa1ba2962be3cb74ee7 Mon Sep 17 00:00:00 2001 From: iCrawl Date: Wed, 17 Aug 2022 21:24:38 +0200 Subject: [PATCH] fix: codelisting --- .../website/src/components/CodeListing.tsx | 32 +++++++++++++------ .../website/src/components/PropertyList.tsx | 10 +++++- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/packages/website/src/components/CodeListing.tsx b/packages/website/src/components/CodeListing.tsx index 359bd8648..3a3ccd554 100644 --- a/packages/website/src/components/CodeListing.tsx +++ b/packages/website/src/components/CodeListing.tsx @@ -2,7 +2,9 @@ import { Badge, Group, Stack, Title } from '@mantine/core'; import type { ReactNode } from 'react'; import { HyperlinkedText } from './HyperlinkedText'; import { TSDoc } from './tsdoc/TSDoc'; -import type { DocProperty } from '~/DocModel/DocProperty'; +import type { DocItem } from '~/DocModel/DocItem'; +import type { AnyDocNodeJSON } from '~/DocModel/comment/CommentNode'; +import type { TokenDocumentation } from '~/util/parse.server'; export enum CodeListingSeparatorType { Type = ':', @@ -10,30 +12,40 @@ export enum CodeListingSeparatorType { } export function CodeListing({ - prop, + name, separator = CodeListingSeparatorType.Type, + typeTokens, + readonly = false, + optional = false, + summary, + comment, children, }: { - prop: ReturnType; + name: string; separator?: CodeListingSeparatorType; + typeTokens: TokenDocumentation[]; + readonly?: boolean; + optional?: boolean; + summary?: ReturnType['summary']; + comment?: AnyDocNodeJSON | null; children?: ReactNode; }) { return ( - + - {prop.readonly ? Readonly : null} - {prop.optional ? Optional : null} + {readonly ? Readonly : null} + {optional ? Optional : null} - {prop.name} + {name} {separator} - <HyperlinkedText tokens={prop.propertyTypeTokens} /> + <HyperlinkedText tokens={typeTokens} /> - {prop.summary && } - {prop.comment && } + {summary && } + {comment && } {children} diff --git a/packages/website/src/components/PropertyList.tsx b/packages/website/src/components/PropertyList.tsx index d99085a81..ecfb1f06b 100644 --- a/packages/website/src/components/PropertyList.tsx +++ b/packages/website/src/components/PropertyList.tsx @@ -6,7 +6,15 @@ export function PropertyList({ data }: { data: ReturnType return ( {data.map((prop) => ( - + ))} );