import { ExclamationIcon, InformationCircleIcon, XCircleIcon, } from '@heroicons/react/solid'; interface AlertProps { title?: React.ReactNode; type?: 'warning' | 'info' | 'error'; children?: React.ReactNode; } const Alert = ({ title, children, type }: AlertProps) => { let design = { bgColor: 'border border-yellow-500 backdrop-blur bg-yellow-400 bg-opacity-20', titleColor: 'text-yellow-100', textColor: 'text-yellow-300', svg: , }; switch (type) { case 'info': design = { bgColor: 'border border-indigo-500 backdrop-blur bg-indigo-400 bg-opacity-20', titleColor: 'text-gray-100', textColor: 'text-gray-300', svg: , }; break; case 'error': design = { bgColor: 'bg-red-600', titleColor: 'text-red-100', textColor: 'text-red-300', svg: , }; break; } return (
{design.svg}
{title && (
{title}
)} {children && (
{children}
)}
); }; export default Alert;