UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

123 lines (122 loc) • 3.77 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var Unmatched_web_exports = {}; __export(Unmatched_web_exports, { Unmatched: () => Unmatched }); module.exports = __toCommonJS(Unmatched_web_exports); var React = __toESM(require("react"), 1); var import_hooks = require("../hooks.cjs"); var import_Link = require("../link/Link.cjs"); var import_jsx_runtime = require("react/jsx-runtime"); function NoSSR({ children }) { const [render, setRender] = React.useState(false); React.useEffect(() => { setRender(true); }, []); return render ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }) : null; } function CurrentURL() { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: window.location.href }); } function Unmatched() { const router = (0, import_hooks.useRouter)(); const pathname = (0, import_hooks.usePathname)(); return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { style: { minHeight: "100vh", boxSizing: "border-box", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", backgroundColor: "black", color: "white", padding: 24, textAlign: "center" }, children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { style: { fontSize: 36, paddingBottom: 12, margin: "0 0 12px", borderBottom: "1px solid #323232" }, children: "Unmatched Route" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: { fontSize: 18, margin: "0 0 12px" }, children: [ "Page could not be found.", " ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => { if (router.canGoBack()) { router.back(); } else { router.replace("/"); } }, style: { appearance: "none", border: 0, padding: 0, background: "transparent", color: "rgba(255,255,255,0.6)", cursor: "pointer", font: "inherit", textDecoration: "underline" }, children: "Go back." }) ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NoSSR, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Link.Link, { href: pathname, replace: true, style: { color: "rgba(255,255,255,0.4)", textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CurrentURL, {}) }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Link.Link, { href: "/_sitemap", replace: true, style: { color: "rgba(255,255,255,0.4)", marginTop: 8, textAlign: "center" }, children: "Sitemap" }) ] }); }