import styles from "./ui-lib.module.scss"; import LoadingIcon from "../icons/three-dots.svg"; import CloseIcon from "../icons/close.svg"; import { createRoot } from 'react-dom/client' export function Popover(props: { children: JSX.Element; content: JSX.Element; open?: boolean; onClose?: () => void; }) { return (
{props.children} {props.open && (
{props.content}
)}
); } export function Card(props: { children: JSX.Element[]; className?: string }) { return (
{props.children}
); } export function ListItem(props: { children: JSX.Element[] }) { if (props.children.length > 2) { throw Error("Only Support Two Children"); } return
{props.children}
; } export function List(props: { children: JSX.Element[] }) { return
{props.children}
; } export function Loading() { return
} interface ModalProps { title: string, children?: JSX.Element, actions?: JSX.Element[], onClose?: () => void, } export function Modal(props: ModalProps) { return
{props.title}
{props.children}
{props.actions?.map((action, i) =>
{action}
)}
} export function showModal(props: ModalProps) { const div = document.createElement('div') div.className = "modal-mask"; document.body.appendChild(div) const root = createRoot(div) root.render( { props.onClose?.(); root.unmount(); div.remove(); }}>) }