UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

31 lines (30 loc) 838 B
"use client"; import { jsx as l, jsxs as u } from "react/jsx-runtime"; import { useState as d, useCallback as i, useMemo as m } from "react"; import { Dialog as f, DialogContent as h, DialogHeader as p, DialogTitle as C } from "../../ui/dialog.js"; function x() { const [o, r] = d(null), n = i(() => { r(null); }, []), s = m(() => { if (o === null) return null; const { title: e, content: t } = o; return /* @__PURE__ */ l(f, { open: !0, onOpenChange: n, children: /* @__PURE__ */ u(h, { children: [ /* @__PURE__ */ l(p, { children: /* @__PURE__ */ l(C, { children: e }) }), t ] }) }); }, [o, n]), a = i( (e, t, c = !1) => { r({ closeOnClickOutside: c, content: t(n), title: e }); }, [n] ); return [s, a]; } export { x as useEditorModal };