Files
prowler/ui/components/shared/status-alert.tsx
T
Pablo Fernandez Guerra (PFE) 2293cab72c fix(ui): adaptive Attack Paths messages for waiting states (#11512)
Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 10:03:35 +02:00

42 lines
1.0 KiB
TypeScript

import { CircleAlert, Info } from "lucide-react";
import type { ReactNode } from "react";
import { Alert, AlertDescription, AlertTitle } from "@/components/shadcn/alert";
const STATUS_ALERT_ICONS = {
info: Info,
error: CircleAlert,
} as const;
type StatusAlertVariant = keyof typeof STATUS_ALERT_ICONS;
interface StatusAlertProps {
variant: StatusAlertVariant;
title: string;
descriptionClassName?: string;
children: ReactNode;
}
/**
* Shared status banner: a shadcn `Alert` with a variant-driven icon, title, and
* description. Use for full-width info/error messages (waiting states, load
* failures, inline notices).
*/
export const StatusAlert = ({
variant,
title,
descriptionClassName,
children,
}: StatusAlertProps) => {
const Icon = STATUS_ALERT_ICONS[variant];
return (
<Alert variant={variant}>
<Icon className="size-4" />
<AlertTitle>{title}</AlertTitle>
<AlertDescription className={descriptionClassName}>
{children}
</AlertDescription>
</Alert>
);
};