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 (
<Stack spacing="xs" key={name}>
<Group>
{deprecation ? (
<Badge variant="filled" color="red">
Deprecated
</Badge>
) : null}
{readonly ? <Badge variant="filled">Readonly</Badge> : null}
{optional ? <Badge variant="filled">Optional</Badge> : null}
<Title order={4} className="font-mono">

View File

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

View File

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

View File

@@ -104,7 +104,7 @@ export function TSDoc({ node }: { node: AnyDocNodeJSON }): JSX.Element {
(block) => block.tag.tagName.toUpperCase() === StandardTags.example.tagNameWithUpperCase,
).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:
console.log(`Captured unknown node kind: ${node.kind}`);