NotFoundPage.tsx 1.8 KB

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