mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
feat: alert & discord components
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Alert } from '@discordjs/ui';
|
||||
import { StandardTags } from '@microsoft/tsdoc';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { VscWarning } from 'react-icons/vsc';
|
||||
|
||||
export function Block({ children, title }: PropsWithChildren<{ title: string }>) {
|
||||
return (
|
||||
@@ -18,26 +18,6 @@ export function ExampleBlock({
|
||||
return <Block title={`Example ${exampleIndex ? exampleIndex : ''}`}>{children}</Block>;
|
||||
}
|
||||
|
||||
export function DeprecatedBlock({ children }: PropsWithChildren): JSX.Element {
|
||||
return (
|
||||
<div className="my-4">
|
||||
<div className="relative flex">
|
||||
<div className="p-4">{children}</div>
|
||||
<div className="absolute flex h-full w-full">
|
||||
<div className="rounded-tl-1.5 rounded-bl-1.5 w-4 shrink-0 border-t-2 border-b-2 border-l-2 border-red-500" />
|
||||
<div className="relative border-b-2 border-red-500">
|
||||
<div className="-translate-y-50% flex place-items-center gap-2 px-2 text-red-500">
|
||||
<VscWarning size={20} />
|
||||
<span className="font-semibold text-red-500">Deprecated</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded-tr-1.5 rounded-br-1.5 flex-1 border-t-2 border-b-2 border-r-2 border-red-500" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function DefaultValueBlock({ children }: PropsWithChildren): JSX.Element {
|
||||
return <Block title="Default value">{children}</Block>;
|
||||
}
|
||||
@@ -58,7 +38,11 @@ export function BlockComment({
|
||||
case StandardTags.example.tagNameWithUpperCase:
|
||||
return <ExampleBlock exampleIndex={index}>{children}</ExampleBlock>;
|
||||
case StandardTags.deprecated.tagNameWithUpperCase:
|
||||
return <DeprecatedBlock>{children}</DeprecatedBlock>;
|
||||
return (
|
||||
<Alert title="Deprecated" type="danger">
|
||||
{children}
|
||||
</Alert>
|
||||
);
|
||||
case StandardTags.remarks.tagNameWithUpperCase:
|
||||
return <RemarksBlock>{children}</RemarksBlock>;
|
||||
case StandardTags.defaultValue.tagNameWithUpperCase:
|
||||
|
||||
Reference in New Issue
Block a user