import { Trans } from "@lingui/macro" import { Box, Alert as MantineAlert } from "@mantine/core" import { Fragment } from "react" import { TbAlertCircle, TbAlertTriangle, TbCircleCheck } from "react-icons/tb" type Level = "error" | "warning" | "success" export interface ErrorsAlertProps { level?: Level messages: string[] } export function Alert(props: ErrorsAlertProps) { let title: React.ReactNode let color: string let icon: React.ReactNode const level = props.level ?? "error" switch (level) { case "error": title = Error color = "red" icon = break case "warning": title = Warning color = "orange" icon = break case "success": title = Success color = "green" icon = break default: throw Error(`unsupported level: ${level}`) } return ( {props.messages.map((m, i) => ( {m} {i !== props.messages.length - 1 &&
}
))}
) }