https://dev.kronoz.win/r/marzneshin.git
| 1 |
4056c66 |
Dawsh |
1y ago |
import { Info, OctagonAlert, TriangleAlert } from "lucide-react"; |
| 2 |
56b916e |
Mardin |
2y ago |
import { |
| 3 |
56b916e |
Mardin |
2y ago |
Alert, |
| 4 |
56b916e |
Mardin |
2y ago |
AlertDescription, |
| 5 |
56b916e |
Mardin |
2y ago |
AlertTitle, |
| 6 |
4056c66 |
Dawsh |
1y ago |
} from "@marzneshin/common/components"; |
| 7 |
4056c66 |
Dawsh |
1y ago |
import { cn } from "@marzneshin/common/utils"; |
| 8 |
56b916e |
Mardin |
2y ago |
|
| 9 |
4056c66 |
Dawsh |
1y ago |
interface AlertCardProps { |
| 10 |
4056c66 |
Dawsh |
1y ago |
variant?: "warning" | "default" | "destructive"; |
| 11 |
4056c66 |
Dawsh |
1y ago |
title: string | JSX.Element; |
| 12 |
4056c66 |
Dawsh |
1y ago |
size?: "wide-full" | "inline"; |
| 13 |
4056c66 |
Dawsh |
1y ago |
desc?: string | JSX.Element; |
| 14 |
4056c66 |
Dawsh |
1y ago |
} |
| 15 |
4056c66 |
Dawsh |
1y ago |
|
| 16 |
4056c66 |
Dawsh |
1y ago |
export const AlertCard = ({ |
| 17 |
4056c66 |
Dawsh |
1y ago |
title, |
| 18 |
4056c66 |
Dawsh |
1y ago |
desc, |
| 19 |
4056c66 |
Dawsh |
1y ago |
variant = "default", |
| 20 |
4056c66 |
Dawsh |
1y ago |
size = "inline", |
| 21 |
4056c66 |
Dawsh |
1y ago |
}: AlertCardProps) => { |
| 22 |
4056c66 |
Dawsh |
1y ago |
const Icon = |
| 23 |
4056c66 |
Dawsh |
1y ago |
variant === "warning" |
| 24 |
4056c66 |
Dawsh |
1y ago |
? TriangleAlert |
| 25 |
4056c66 |
Dawsh |
1y ago |
: variant === "destructive" |
| 26 |
4056c66 |
Dawsh |
1y ago |
? OctagonAlert |
| 27 |
4056c66 |
Dawsh |
1y ago |
: Info; |
| 28 |
56b916e |
Mardin |
2y ago |
return ( |
| 29 |
4056c66 |
Dawsh |
1y ago |
<Alert |
| 30 |
4056c66 |
Dawsh |
1y ago |
variant={variant} |
| 31 |
4056c66 |
Dawsh |
1y ago |
className={cn({ |
| 32 |
4056c66 |
Dawsh |
1y ago |
"flex flex-col justify-center items-center max-h-full h-[5.8rem] w-full gap-2 border-0": |
| 33 |
4056c66 |
Dawsh |
1y ago |
size === "wide-full", |
| 34 |
4056c66 |
Dawsh |
1y ago |
})} |
| 35 |
4056c66 |
Dawsh |
1y ago |
> |
| 36 |
4056c66 |
Dawsh |
1y ago |
<div> |
| 37 |
4056c66 |
Dawsh |
1y ago |
<Icon |
| 38 |
4056c66 |
Dawsh |
1y ago |
className={cn("size-8", { |
| 39 |
4056c66 |
Dawsh |
1y ago |
"": (size = "inline"), |
| 40 |
4056c66 |
Dawsh |
1y ago |
})} |
| 41 |
4056c66 |
Dawsh |
1y ago |
/> |
| 42 |
4056c66 |
Dawsh |
1y ago |
</div> |
| 43 |
56b916e |
Mardin |
2y ago |
<AlertTitle className="font-semibold">{title}</AlertTitle> |
| 44 |
4056c66 |
Dawsh |
1y ago |
<AlertDescription>{desc}</AlertDescription> |
| 45 |
56b916e |
Mardin |
2y ago |
</Alert> |
| 46 |
4056c66 |
Dawsh |
1y ago |
); |
| 47 |
4056c66 |
Dawsh |
1y ago |
}; |