mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-02 00:46:38 +08:00
71 lines
1.5 KiB
TypeScript
71 lines
1.5 KiB
TypeScript
import * as React from "react";
|
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
const alertVariants = cva(
|
|
"relative w-full rounded-lg border px-4 py-3 text-sm",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "border-default-200 bg-default-50/70 text-foreground",
|
|
destructive:
|
|
"border-danger-200 bg-danger-50 text-danger-700 dark:text-danger-300",
|
|
success:
|
|
"border-success-200 bg-success-50 text-success-700 dark:text-success-300",
|
|
warning:
|
|
"border-warning-200 bg-warning-50 text-warning-700 dark:text-warning-300",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
},
|
|
},
|
|
);
|
|
|
|
function Alert({
|
|
className,
|
|
variant,
|
|
...props
|
|
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
return (
|
|
<div
|
|
className={cn(alertVariants({ className, variant }))}
|
|
data-slot="alert"
|
|
role="alert"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function AlertTitle({
|
|
className,
|
|
children,
|
|
...props
|
|
}: React.ComponentProps<"h5">) {
|
|
return (
|
|
<h5
|
|
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
|
data-slot="alert-title"
|
|
{...props}
|
|
>
|
|
{children}
|
|
</h5>
|
|
);
|
|
}
|
|
|
|
function AlertDescription({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
className={cn("text-sm opacity-90", className)}
|
|
data-slot="alert-description"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export { Alert, AlertDescription, AlertTitle };
|