NotFoundPage.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { useNavigate } from 'react-router';
  2. import { ArrowLeft, Home } from 'lucide-react';
  3. import { Button } from '@/client/components/ui/button';
  4. import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/client/components/ui/card';
  5. export const NotFoundPage = () => {
  6. const navigate = useNavigate();
  7. return (
  8. <div className="flex flex-col items-center justify-center min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 p-4">
  9. <Card className="w-full max-w-md border-0 shadow-xl">
  10. <CardHeader className="text-center">
  11. <div className="mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-primary/10 mb-4">
  12. <span className="text-4xl font-bold text-primary">404</span>
  13. </div>
  14. <CardTitle className="text-2xl">页面未找到</CardTitle>
  15. <CardDescription>
  16. 抱歉,您访问的页面不存在或已被移除
  17. </CardDescription>
  18. </CardHeader>
  19. <CardContent className="text-center">
  20. <p className="text-muted-foreground">
  21. 请检查URL是否正确,或尝试以下操作:
  22. </p>
  23. </CardContent>
  24. <CardFooter className="flex gap-2">
  25. <Button
  26. onClick={() => navigate(-1)}
  27. variant="outline"
  28. className="flex-1"
  29. >
  30. <ArrowLeft className="h-4 w-4 mr-2" />
  31. 返回上一页
  32. </Button>
  33. <Button
  34. onClick={() => navigate('/')}
  35. className="flex-1"
  36. >
  37. <Home className="h-4 w-4 mr-2" />
  38. 返回首页
  39. </Button>
  40. </CardFooter>
  41. </Card>
  42. </div>
  43. );
  44. };