feat(website): show parameter descriptions (#8519)

Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
Suneet Tipirneni
2022-08-18 12:38:27 -04:00
committed by GitHub
parent cda3f005b1
commit 7f415a2502
8 changed files with 98 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
import { Box } from '@mantine/core';
import { Box, ScrollArea } from '@mantine/core';
import { HyperlinkedText } from './HyperlinkedText';
import { Table } from './Table';
import { TSDoc } from './tsdoc/TSDoc';
import type { ParameterDocumentation } from '~/util/parse.server';
export function ParameterTable({ data }: { data: ParameterDocumentation[] }) {
@@ -8,17 +9,19 @@ export function ParameterTable({ data }: { data: ParameterDocumentation[] }) {
Name: param.name,
Type: <HyperlinkedText tokens={param.tokens} />,
Optional: param.isOptional ? 'Yes' : 'No',
Description: 'None',
Description: param.paramCommentBlock ? <TSDoc node={param.paramCommentBlock} /> : 'None',
}));
const columnStyles = {
Name: 'font-mono',
Type: 'font-mono',
Name: 'font-mono whitespace-nowrap',
Type: 'font-mono whitespace-pre-wrap break-normal',
};
return (
<Box sx={{ overflowX: 'auto' }}>
<Table columns={['Name', 'Type', 'Optional', 'Description']} rows={rows} columnStyles={columnStyles} />
<Box>
<ScrollArea type="auto">
<Table columns={['Name', 'Type', 'Optional', 'Description']} rows={rows} columnStyles={columnStyles} />
</ScrollArea>
</Box>
);
}