mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 12:40:08 +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() {
|
export default function ErrorPage() {
|
||||||
const error: any = useRouteError();
|
const error = useRouteError() as RouterError;
|
||||||
|
const navigate = useNavigate();
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="error-page">
|
<div className="min-h-screen w-full flex items-center justify-center bg-background p-4">
|
||||||
<h1>Oops!</h1>
|
<Card className="w-full max-w-md shadow-2xl rounded-2xl">
|
||||||
<p>Sorry, an unexpected error has occurred.</p>
|
<CardContent className="pt-6 text-center space-y-4">
|
||||||
<p>
|
<div className="flex justify-center">
|
||||||
<i>{error.statusText || error.message}</i>
|
<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>
|
</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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user