-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): show parameter descriptions (#8519)
Co-authored-by: Noel <buechler.noel@outlook.com>
- Loading branch information
1 parent
cda3f00
commit 7f415a2
Showing
8 changed files
with
98 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model'; | ||
import type { DocParamBlock } from '@microsoft/tsdoc'; | ||
import { block, DocBlockJSON } from './CommentBlock'; | ||
|
||
export interface DocParamBlockJSON extends DocBlockJSON { | ||
name: string; | ||
} | ||
|
||
export function paramBlock(paramBlock: DocParamBlock, model: ApiModel, parentItem?: ApiItem): DocParamBlockJSON { | ||
return { | ||
...block(paramBlock, model, parentItem), | ||
name: paramBlock.parameterName, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
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[] }) { | ||
const rows = data.map((param) => ({ | ||
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7f415a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
discord-js – ./
discord-js-number-one.vercel.app
discord-js-git-main-discordjs.vercel.app
discord-js-discordjs.vercel.app
discordjs.dev
www.discordjs.dev