export type ToastVariant = "info" | "success" | "warning";

type ToastProps = {
  title: string;
  message: string;
  variant?: ToastVariant;
  onDismiss?: () => void;
};

export function Toast({ title, message, variant = "info", onDismiss }: ToastProps) {
  return (
    <aside className={`ui-toast ui-toast-${variant}`} role="status">
      <div>
        <strong>{title}</strong>
        <span>{message}</span>
      </div>
      {onDismiss && (
        <button className="toast-dismiss" type="button" onClick={onDismiss} aria-label={`Dismiss ${title}`}>
          x
        </button>
      )}
    </aside>
  );
}
