import { useLocal } from "@/utils/use-local"; import { FC, useEffect } from "react"; import { X } from "lucide-react"; import { Button } from "../../ui/button"; export const PopUpDropdown: FC<{ on_select: (val: any) => void; on_close: () => void; title: string; options: () => Promise<{ value: string; label: string }[]>; }> = ({ on_close, title, options, on_select }) => { const local = useLocal({ list: [] as { value: string; label: string }[], status: "init" as "init" | "loading" | "ready", }); useEffect(() => { if (local.status === "init") { local.status = "loading"; local.render(); options().then((result) => { local.list = result; local.status = "ready"; local.render(); }); } }, [options]); return (