Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 107x 45x 45x 45x 2x 2x 1x | import { Cross2Icon, InfoCircledIcon } from "@radix-ui/react-icons";
import type { MouseEvent } from "react";
import { Link } from "react-router";
import { useGetSystemNotifs } from "@/api";
import { FAQ_TAB } from "@/consts";
const SystemAlertBanner = () => {
const { clearNotif, notifications } = useGetSystemNotifs();
const selectedBanner = notifications[0];
if (!selectedBanner) return null;
const { header, body, buttonText, buttonLink, disabled, notifId } = selectedBanner;
const handleClick = (e: MouseEvent<HTMLAnchorElement>) => {
if (disabled) e.preventDefault();
};
return (
<section
className="bg-[#E1F3F8] grid md:grid-cols-[min-content_auto_min-content] md:grid-rows-[auto_auto] grid-cols-[auto_auto] gap-4 md:gap-x-4 border-l-[8px] border-[#00A6D2] p-3"
aria-label="system-alert-banner"
>
<InfoCircledIcon className="w-10 h-10 text-black" aria-hidden="true" />
<div className="flex gap-x-4 flex-grow">
<div className="flex flex-col flex-grow">
<h3 className="font-bold text-black text-lg break-words">{header}</h3>
<p className="text-black leading-normal break-words">{body}</p>
</div>
</div>
<div className="flex space-x-4 col-start-2 md:col-start-auto">
{buttonText && (
<Link
to={buttonLink}
onClick={handleClick}
target={FAQ_TAB}
rel="noopener noreferrer"
className="border-2 border-black rounded h-[38px] px-4 text font-bold text-center whitespace-nowrap pt-1 text-black"
>
{buttonText}
</Link>
)}
<button
onClick={() => clearNotif(notifId)}
aria-label="Dismiss"
className="rounded-full w-6 h-6"
>
<Cross2Icon className="w-full h-full text-black" aria-hidden="true" />
</button>
</div>
</section>
);
};
export default SystemAlertBanner;
|