wip: search modal (link, category, or Google) with keybinds

This commit is contained in:
Sonny
2023-04-24 01:37:55 +02:00
parent d055387363
commit 43c7aab885
11 changed files with 595 additions and 46 deletions

View File

@@ -0,0 +1,32 @@
import { ReactNode } from "react";
import { createPortal } from "react-dom";
import styles from "./modal.module.scss";
interface ModalProps {
close?: (...args: any) => void | Promise<void>;
title?: string;
children: ReactNode;
showCloseBtn?: boolean;
}
export default function Modal({
close,
title,
children,
showCloseBtn = true,
}: ModalProps) {
return createPortal(
<div className={styles["modal-wrapper"]}>
<div className={styles["modal-container"]}>
<div className={styles["modal-header"]}>
<h3>{title}</h3>
{showCloseBtn && <button onClick={close}>close</button>}
</div>
<div className={styles["modal-body"]}>{children}</div>
</div>
</div>,
document.body
);
}