2024-09-01 14:01:45 +02:00
|
|
|
import { translationAtom } from "@/atoms/translations-atom";
|
2023-11-26 09:04:03 +01:00
|
|
|
import { GrayMatterFile } from "gray-matter";
|
2024-09-01 14:01:45 +02:00
|
|
|
import { useAtomValue } from "jotai";
|
2023-11-23 06:58:29 +01:00
|
|
|
import React from "react";
|
2023-11-26 09:04:03 +01:00
|
|
|
import Markdown from "react-markdown";
|
|
|
|
import remarkGfm from "remark-gfm";
|
2023-11-23 06:58:29 +01:00
|
|
|
|
2023-11-26 09:04:03 +01:00
|
|
|
export const NewsModal = ({
|
|
|
|
show,
|
|
|
|
setShow,
|
|
|
|
news,
|
|
|
|
}: {
|
|
|
|
show: boolean;
|
|
|
|
setShow: React.Dispatch<React.SetStateAction<boolean>>;
|
|
|
|
news: GrayMatterFile<string>;
|
|
|
|
}) => {
|
2024-09-01 14:01:45 +02:00
|
|
|
const t = useAtomValue(translationAtom);
|
|
|
|
|
2023-11-23 06:58:29 +01:00
|
|
|
return (
|
|
|
|
<dialog className={`modal ${show && "modal-open"}`}>
|
2024-09-01 14:01:45 +02:00
|
|
|
<div className="modal-box flex flex-col items-center gap-4 text-center">
|
2023-11-23 06:58:29 +01:00
|
|
|
<button
|
2024-09-01 14:01:45 +02:00
|
|
|
className="btn btn-circle absolute right-4 top-2"
|
|
|
|
onClick={() => setShow(false)}
|
|
|
|
>
|
2023-11-23 06:58:29 +01:00
|
|
|
<svg
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
width="24"
|
|
|
|
height="24"
|
2024-09-01 14:01:45 +02:00
|
|
|
viewBox="0 0 24 24"
|
|
|
|
>
|
2023-11-23 06:58:29 +01:00
|
|
|
<rect
|
|
|
|
x="0"
|
|
|
|
y="0"
|
|
|
|
width="24"
|
|
|
|
height="24"
|
|
|
|
fill="none"
|
|
|
|
stroke="none"
|
|
|
|
/>
|
|
|
|
<path
|
|
|
|
fill="none"
|
|
|
|
stroke="currentColor"
|
|
|
|
stroke-linecap="round"
|
|
|
|
stroke-width="1.5"
|
|
|
|
d="m8.464 15.535l7.072-7.07m-7.072 0l7.072 7.07"
|
|
|
|
/>
|
|
|
|
</svg>
|
|
|
|
</button>
|
2023-11-23 10:25:55 +01:00
|
|
|
|
2023-11-26 09:04:03 +01:00
|
|
|
<div>
|
|
|
|
{news && (
|
|
|
|
<Markdown remarkPlugins={[remarkGfm]} className="prose">
|
|
|
|
{news.content}
|
|
|
|
</Markdown>
|
|
|
|
)}
|
2023-11-23 10:25:55 +01:00
|
|
|
</div>
|
2023-11-23 06:58:29 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<form method="dialog" className="modal-backdrop">
|
2024-09-01 14:01:45 +02:00
|
|
|
<button onClick={() => setShow(false)}>
|
2024-09-03 09:34:58 +02:00
|
|
|
{t("APP.DIALOG_BOX.CLOSE")}
|
2024-09-01 14:01:45 +02:00
|
|
|
</button>
|
2023-11-23 06:58:29 +01:00
|
|
|
</form>
|
|
|
|
</dialog>
|
|
|
|
);
|
|
|
|
};
|