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

View File

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