feat: deprecation badges

This commit is contained in:
iCrawl
2022-08-18 18:47:44 +02:00
parent 7f415a2502
commit 673262d38c
4 changed files with 12 additions and 2 deletions

View File

@@ -35,6 +35,11 @@ export function CodeListing({
return ( return (
<Stack spacing="xs" key={name}> <Stack spacing="xs" key={name}>
<Group> <Group>
{deprecation ? (
<Badge variant="filled" color="red">
Deprecated
</Badge>
) : null}
{readonly ? <Badge variant="filled">Readonly</Badge> : null} {readonly ? <Badge variant="filled">Readonly</Badge> : null}
{optional ? <Badge variant="filled">Optional</Badge> : null} {optional ? <Badge variant="filled">Optional</Badge> : null}
<Title order={4} className="font-mono"> <Title order={4} className="font-mono">

View File

@@ -30,6 +30,11 @@ export function MethodItem({ data }: { data: MethodResolvable }) {
<Group> <Group>
<Stack> <Stack>
<Group> <Group>
{data.deprecated ? (
<Badge variant="filled" color="red">
Deprecated
</Badge>
) : null}
{data.kind === 'Method' && method.visibility === Visibility.Protected ? ( {data.kind === 'Method' && method.visibility === Visibility.Protected ? (
<Badge variant="filled">Protected</Badge> <Badge variant="filled">Protected</Badge>
) : null} ) : null}

View File

@@ -34,7 +34,7 @@ export function ExampleBlock({ children, exampleIndex }: ExampleBlockProps): JSX
export function DeprecatedBlock({ children }: { children: ReactNode }): JSX.Element { export function DeprecatedBlock({ children }: { children: ReactNode }): JSX.Element {
return ( return (
<Alert icon={<VscWarning />} title="Deprecated" color="red" radius="xs"> <Alert icon={<VscWarning />} title="Deprecated" variant="filled" color="red" radius="xs">
{children} {children}
</Alert> </Alert>
); );

View File

@@ -104,7 +104,7 @@ export function TSDoc({ node }: { node: AnyDocNodeJSON }): JSX.Element {
(block) => block.tag.tagName.toUpperCase() === StandardTags.example.tagNameWithUpperCase, (block) => block.tag.tagName.toUpperCase() === StandardTags.example.tagNameWithUpperCase,
).length; ).length;
return <div key={idx}>{comment.customBlocks.map((node, idx) => createNode(node, idx))}</div>; return <Box key={idx}>{comment.customBlocks.map((node, idx) => createNode(node, idx))}</Box>;
} }
default: default:
console.log(`Captured unknown node kind: ${node.kind}`); console.log(`Captured unknown node kind: ${node.kind}`);