2024-11-04 23:57:43 +01:00
|
|
|
import TextCopyBlock from "@/components/TextCopyBlock";
|
2024-11-13 22:33:45 +01:00
|
|
|
import { AlertColors } from "@/config/siteConfig";
|
2024-11-04 23:55:08 +01:00
|
|
|
import { Script } from "@/lib/types";
|
2024-11-13 22:33:45 +01:00
|
|
|
import { cn } from "@/lib/utils";
|
2024-11-16 12:15:17 +01:00
|
|
|
import { AlertCircle, NotepadText } from "lucide-react";
|
2024-11-04 23:55:08 +01:00
|
|
|
|
2024-11-13 22:33:45 +01:00
|
|
|
type NoteProps = {
|
|
|
|
|
text: string;
|
|
|
|
|
type: keyof typeof AlertColors;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-04 23:55:08 +01:00
|
|
|
export default function Alerts({ item }: { item: Script }) {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2024-11-06 23:47:04 +01:00
|
|
|
{item?.notes?.length > 0 &&
|
2024-11-13 22:33:45 +01:00
|
|
|
item.notes.map((note: NoteProps, index: number) => (
|
2024-11-04 23:55:08 +01:00
|
|
|
<div key={index} className="mt-4 flex flex-col gap-2">
|
2024-11-13 22:33:45 +01:00
|
|
|
<p
|
|
|
|
|
className={cn(
|
|
|
|
|
"inline-flex items-center gap-2 rounded-lg border p-2 pl-4 text-sm",
|
|
|
|
|
AlertColors[note.type],
|
|
|
|
|
)}
|
|
|
|
|
>
|
2024-11-16 12:15:17 +01:00
|
|
|
{note.type == "info" ? (
|
|
|
|
|
<NotepadText className="h-4 min-h-4 w-4 min-w-4" />
|
|
|
|
|
) : (
|
|
|
|
|
<AlertCircle className="h-4 min-h-4 w-4 min-w-4" />
|
|
|
|
|
)}
|
2024-11-06 23:47:04 +01:00
|
|
|
<span>{TextCopyBlock(note.text)}</span>
|
2024-11-04 23:55:08 +01:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|