mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-09 12:13:10 -05:00
26 lines
673 B
TypeScript
26 lines
673 B
TypeScript
import clsx from "clsx";
|
|
import { AlertIcon } from "./icons/Alert";
|
|
import { SuccessIcon } from "./icons/Success";
|
|
|
|
// TODO: should flex-dir column on mobile
|
|
export function Alert(props: {
|
|
children: React.ReactNode;
|
|
type: "warning" | "info" | "success";
|
|
className?: string;
|
|
rightAction?: React.ReactNode;
|
|
"data-cy"?: string;
|
|
}) {
|
|
return (
|
|
<div
|
|
data-type={props.type}
|
|
className={clsx("alert", props.className)}
|
|
data-cy={props["data-cy"]}
|
|
>
|
|
{(props.type === "warning" || props.type === "info") && <AlertIcon />}
|
|
{props.type === "success" && <SuccessIcon />}
|
|
{props.children}
|
|
{props.rightAction}
|
|
</div>
|
|
);
|
|
}
|