mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 04:30:06 +00:00
style: error-page (#4)
This commit is contained in:
@@ -1,16 +1,46 @@
|
||||
import { useRouteError } from "react-router-dom";
|
||||
import { useRouteError, useNavigate } from "react-router-dom";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardFooter } from "@/components/ui/card";
|
||||
import { AlertCircle } from "lucide-react";
|
||||
|
||||
interface RouterError {
|
||||
statusText?: string;
|
||||
message?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export default function ErrorPage() {
|
||||
const error: any = useRouteError();
|
||||
const error = useRouteError() as RouterError;
|
||||
const navigate = useNavigate();
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
<div id="error-page">
|
||||
<h1>Oops!</h1>
|
||||
<p>Sorry, an unexpected error has occurred.</p>
|
||||
<p>
|
||||
<i>{error.statusText || error.message}</i>
|
||||
<div className="min-h-screen w-full flex items-center justify-center bg-background p-4">
|
||||
<Card className="w-full max-w-md shadow-2xl rounded-2xl">
|
||||
<CardContent className="pt-6 text-center space-y-4">
|
||||
<div className="flex justify-center">
|
||||
<AlertCircle className="h-12 w-12 text-destructive" />
|
||||
</div>
|
||||
<h1 className="text-4xl font-bold tracking-tight">Oops!</h1>
|
||||
<p className="text-lg text-muted-foreground/80">
|
||||
Sorry, an unexpected error has occurred.
|
||||
</p>
|
||||
<div className="p-4 bg-muted/70 rounded-lg">
|
||||
<p className="text-sm text-destructive font-semibold italic">
|
||||
{error.statusText || error.message}
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
<CardFooter className="flex justify-center pb-6">
|
||||
<Button
|
||||
variant="default"
|
||||
size="lg"
|
||||
onClick={() => navigate('/dashboard')}
|
||||
>
|
||||
Back to Dashboard
|
||||
</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user