mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-08 03:18:36 +03:00
44 lines
917 B
JavaScript
44 lines
917 B
JavaScript
import React from "react";
|
|
import marked from "marked";
|
|
|
|
const fontSize = window.innerWidth > 1000 ? 14 : 18;
|
|
|
|
const Popup = ({
|
|
content = [],
|
|
styles = {},
|
|
isOpen = true,
|
|
onClose,
|
|
title,
|
|
theme = "light",
|
|
children,
|
|
}) => (
|
|
<div>
|
|
<div
|
|
className={`infopopup__bg ${isOpen ? "" : "hidden"}`}
|
|
onClick={onClose}
|
|
></div>
|
|
<div
|
|
className={`infopopup ${isOpen ? "" : "hidden"} ${
|
|
theme === "dark" ? "dark" : "light"
|
|
}`}
|
|
style={{ ...styles, fontSize }}
|
|
>
|
|
<div className="legend-header">
|
|
<button
|
|
onClick={onClose}
|
|
className="side-menu-burg over-white is-active"
|
|
>
|
|
<span />
|
|
</button>
|
|
<h2>{title}</h2>
|
|
</div>
|
|
{content.map((t, idx) => (
|
|
<div key={idx} dangerouslySetInnerHTML={{ __html: marked(t) }} />
|
|
))}
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
export default Popup;
|