fix: properly check for properties and methods

This commit is contained in:
iCrawl
2022-08-22 14:32:59 +02:00
parent e5678f4656
commit d9e53093f5
2 changed files with 14 additions and 6 deletions

View File

@@ -104,7 +104,7 @@ export function DocContainer({
<Stack>{children}</Stack>
</Stack>
</Stack>
{kind === 'Class' && methods && properties ? (
{kind === 'Class' && (methods?.length || properties?.length) ? (
<MediaQuery smallerThan="md" styles={{ display: 'none' }}>
<Aside
sx={{ backgroundColor: 'transparent' }}
@@ -113,7 +113,7 @@ export function DocContainer({
withBorder={false}
>
<ScrollArea p="xs">
<TableOfContentItems properties={properties} methods={methods}></TableOfContentItems>
<TableOfContentItems properties={properties ?? []} methods={methods ?? []}></TableOfContentItems>
</ScrollArea>
</Aside>
</MediaQuery>

View File

@@ -68,10 +68,18 @@ export function TableOfContentItems({
<VscListSelection size={20} />
<Text>Table of content</Text>
</Group>
<Text>Properties</Text>
{propertyItems}
<Text>Methods</Text>
{methodItems}
{propertyItems.length ? (
<>
<Text>Properties</Text>
{propertyItems}
</>
) : null}
{methodItems.length ? (
<>
<Text>Methods</Text>
{methodItems}
</>
) : null}
</Box>
);
}