one
Version:
One is a new React Framework that makes Vite serve both native and web.
84 lines (83 loc) • 2.16 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
const mono = {
color: "white",
fontFamily: "monospace",
margin: 0
};
function RouteErrorView({
routeName,
error,
errorInfo,
onRetry
}) {
return /* @__PURE__ */jsx("div", {
style: {
backgroundColor: "#000",
padding: 16
},
children: /* @__PURE__ */jsxs("div", {
style: {
display: "flex",
flexDirection: "column",
gap: 16
},
children: [/* @__PURE__ */jsx("div", {
children: /* @__PURE__ */jsxs("span", {
style: {
padding: 5,
backgroundColor: "red",
color: "white",
fontSize: 20,
fontFamily: "monospace"
},
children: ['Error on route "', routeName, '"']
})
}), /* @__PURE__ */jsx("pre", {
style: {
...mono,
fontSize: 16,
whiteSpace: "pre-wrap"
},
children: error instanceof Error ? error.message : String(error)
}), /* @__PURE__ */jsx("div", {
children: /* @__PURE__ */jsx("button", {
type: "button",
onClick: onRetry,
style: {
padding: 6,
border: "none",
backgroundColor: "white",
color: "black",
fontSize: 14,
fontFamily: "monospace",
cursor: "pointer"
},
children: "Retry"
})
}), /* @__PURE__ */jsxs("div", {
style: {
display: "flex",
flexDirection: "column",
gap: 12
},
children: [error instanceof Error ? /* @__PURE__ */jsx("pre", {
style: {
...mono,
fontSize: 12,
whiteSpace: "pre-wrap"
},
children: error.stack
}) : null, errorInfo?.componentStack ? /* @__PURE__ */jsxs("pre", {
style: {
...mono,
fontSize: 12,
whiteSpace: "pre-wrap"
},
children: ["Component Stack: ", errorInfo.componentStack]
}) : null]
})]
})
});
}
export { RouteErrorView };
//# sourceMappingURL=RouteErrorView.mjs.map