33 lines
769 B
TypeScript
33 lines
769 B
TypeScript
"use client";
|
|
|
|
import { HTMLAttributes, ReactNode } from "react";
|
|
|
|
interface AlertProps extends HTMLAttributes<HTMLDivElement> {
|
|
children: ReactNode;
|
|
variant?: "success" | "error" | "warning" | "info";
|
|
}
|
|
|
|
const variantClasses = {
|
|
success: "bg-green-900/50 border-green-500/50 text-green-400",
|
|
error: "bg-red-900/50 border-red-500/50 text-red-400",
|
|
warning: "bg-yellow-900/50 border-yellow-500/50 text-yellow-400",
|
|
info: "bg-blue-900/50 border-blue-500/50 text-blue-400",
|
|
};
|
|
|
|
export default function Alert({
|
|
children,
|
|
variant = "info",
|
|
className = "",
|
|
...props
|
|
}: AlertProps) {
|
|
return (
|
|
<div
|
|
className={`border rounded px-4 py-3 text-sm ${variantClasses[variant]} ${className}`}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|