Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ThreadErrorBanner.tsx

35 lines1.0 KB

1import { memo } from "react";
2import { Alert, AlertAction, AlertDescription } from "../ui/alert";
3import { CircleAlertIcon, XIcon } from "lucide-react";
4​
5export const ThreadErrorBanner = memo(function ThreadErrorBanner({
6 error,
7 onDismiss,
8}: {
9 error: string | null;
10 onDismiss?: () => void;
11}) {
12 if (!error) return null;
13 return (
14 <div className="pt-3 mx-auto max-w-3xl">
15 <Alert variant="error">
16 <CircleAlertIcon />
17 <AlertDescription className="line-clamp-3" title={error}>
18 {error}
19 </AlertDescription>
20 {onDismiss && (
21 <AlertAction>
22 <button
23 type="button"
24 aria-label="Dismiss error"
25 className="inline-flex size-6 items-center justify-center rounded-md text-destructive/60 transition-colors hover:text-destructive"
26 onClick={onDismiss}
27 >
28 <XIcon className="size-3.5" />
29 </button>
30 </AlertAction>
31 )}
32 </Alert>
33 </div>
34 );
35});