UNPKG

analytica-frontend-lib

Version:

Repositório público dos componentes utilizados nas plataformas da Analytica Ensino

115 lines (113 loc) 3.46 kB
import { Button_default } from "./chunk-LAYB7IKW.mjs"; import { Text_default } from "./chunk-IMCIR6TJ.mjs"; import { cn } from "./chunk-53ICLDGS.mjs"; // src/components/NotFound/NotFound.tsx import { jsx, jsxs } from "react/jsx-runtime"; var NotFound = ({ title, description, buttonText = "Voltar", onButtonClick, className = "", errorType = "404", customErrorCode }) => { const getErrorCode = () => { if (errorType === "custom") { return customErrorCode?.trim() || "ERROR"; } return errorType; }; const getDefaultTitle = () => { switch (errorType) { case "404": return "P\xE1gina n\xE3o encontrada"; case "500": return "Erro interno do servidor"; default: return "Erro"; } }; const getDefaultDescription = () => { switch (errorType) { case "404": return "Oops! A p\xE1gina que voc\xEA est\xE1 procurando n\xE3o existe ou foi removida."; case "500": return "Algo deu errado em nossos servidores. Tente novamente mais tarde."; default: return "Ocorreu um erro inesperado."; } }; const handleButtonClick = (event) => { event.preventDefault(); onButtonClick?.(); }; const errorTitle = title || getDefaultTitle(); const errorDescription = description || getDefaultDescription(); const errorCode = getErrorCode(); return /* @__PURE__ */ jsx( "div", { className: cn( "flex flex-col w-full h-screen items-center justify-center bg-background-50 px-4", className ), children: /* @__PURE__ */ jsx( "main", { role: "main", "aria-labelledby": "error-title", "aria-describedby": "error-description", className: "flex flex-col items-center text-center max-w-md space-y-6", children: /* @__PURE__ */ jsxs("section", { "aria-label": `Erro ${errorCode}`, children: [ /* @__PURE__ */ jsx( "div", { className: "text-8xl font-bold text-primary-300 select-none", "aria-label": `C\xF3digo de erro: ${errorCode}`, children: errorCode } ), /* @__PURE__ */ jsxs("header", { className: "space-y-2", children: [ /* @__PURE__ */ jsx( Text_default, { size: "xl", weight: "bold", className: "text-text-950", id: "error-title", "aria-level": 1, children: errorTitle } ), /* @__PURE__ */ jsx(Text_default, { size: "md", className: "text-text-600", id: "error-description", children: errorDescription }) ] }), onButtonClick && /* @__PURE__ */ jsx("nav", { "aria-label": "Navega\xE7\xE3o de erro", children: /* @__PURE__ */ jsx( Button_default, { onClick: handleButtonClick, variant: "solid", size: "medium", className: "mt-8", "aria-describedby": "error-description", "aria-label": `${buttonText}. ${errorDescription}`, children: buttonText } ) }) ] }) } ) } ); }; var NotFound_default = NotFound; export { NotFound_default }; //# sourceMappingURL=chunk-FKYZSN7R.mjs.map