UNPKG

react-ios-pwa-prompt

Version:

A React component to prompt the user to add the app as a PWA to the home screen with native iOS styles.

62 lines (61 loc) 1.74 kB
import { jsxs as m, jsx as o } from "react/jsx-runtime"; import { useState as v, useEffect as l } from "react"; import { Description as b } from "../Description/Description.js"; import { Divider as f } from "../Divider/Divider.js"; import { Header as x } from "../Header/Header.js"; import { Overlay as y } from "../Overlay/Overlay.js"; import { Panel as L } from "../Panel/Panel.js"; import { StepList as O } from "../StepList/StepList.js"; import '../../assets/Container.css';const h = "_container_1w4ni_1", j = "_noScroll_1w4ni_9", n = { container: h, noScroll: j }, N = ({ appIconPath: a, copyAddToHomeScreenStep: p, copyDescription: d, copyShareStep: u, copySubtitle: S, copyTitle: _, delay: e, onClose: i }) => { const [t, s] = v(!e); l(() => { e && setTimeout(() => { var r; (r = document == null ? void 0 : document.activeElement) == null || r.blur(), s(!0); }, e); }, []), l(() => { t && document.body.classList.add(n.noScroll); }, [t]); const c = (r) => { document.body.classList.remove(n.noScroll), s(!1), typeof i == "function" && i(r); }; return /* @__PURE__ */ m("div", { className: n.container, children: [ /* @__PURE__ */ o(y, { isOpen: t, onClose: c }), /* @__PURE__ */ m(L, { isOpen: t, children: [ /* @__PURE__ */ o( x, { appIconPath: a, copySubtitle: S, copyTitle: _, onClose: c } ), /* @__PURE__ */ o(f, {}), /* @__PURE__ */ o(b, { copyDescription: d }), /* @__PURE__ */ o(f, {}), /* @__PURE__ */ o( O, { copyShareStep: u, copyAddToHomeScreenStep: p } ) ] }) ] }); }; export { N as Container };