import React, { useState } from "react"; import styles from "./Alert.module.scss"; import classNames from "classnames"; import { CSSTransition } from "react-transition-group"; import { AiOutlineInfoCircle } from "react-icons/ai"; import { BiAlarmExclamation } from "react-icons/bi"; import { FaRegCheckCircle } from "react-icons/fa"; import { FiAlertTriangle, FiX } from "react-icons/fi"; import { IconButton } from "../IconButton"; import { Typography } from "../Typography/Typography"; export type AlertVariant = "error" | "info" | "success" | "warning"; export interface AlertProps extends React.ComponentPropsWithoutRef<"div"> { children: string; closeable?: boolean; variant?: AlertVariant; iconColor?: string; backgroundColor?: string; } export const Alert: React.FC = (props) => { const { className, children, closeable = false, variant = "error", iconColor, backgroundColor, ...rest } = props; const alertIcon = ( <> {variant === "error" && } {variant === "info" && } {variant === "success" && } {variant === "warning" && } ); const [isOpen, setIsOpen] = useState(true); return (
{alertIcon}
{variant?.toUpperCase()}
{children}
{closeable && ( } onClick={() => { setIsOpen(false); }} /> )}
); }; Alert.displayName = "Alert";