NotFoundPage.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import React from 'react';
  2. import { useNavigate } from 'react-router';
  3. export const NotFoundPage = () => {
  4. const navigate = useNavigate();
  5. return (
  6. <div className="flex flex-col items-center justify-center min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800 p-4">
  7. <div className="w-full max-w-md bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden transition-all duration-300 hover:shadow-xl">
  8. <div className="bg-blue-50 dark:bg-blue-900/30 px-6 py-4 border-b border-blue-100 dark:border-blue-800">
  9. <h1 className="text-2xl font-bold text-blue-600 dark:text-blue-400">404 - 页面未找到</h1>
  10. </div>
  11. <div className="p-6">
  12. <div className="flex items-start mb-6">
  13. <div className="flex-shrink-0 bg-blue-100 dark:bg-blue-900/50 p-3 rounded-full">
  14. <svg className="w-10 h-10 text-blue-500 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
  15. <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  16. </svg>
  17. </div>
  18. <div className="ml-4">
  19. <p className="text-lg text-gray-700 dark:text-gray-300">您访问的页面不存在或已被移除</p>
  20. <p className="mt-2 text-gray-500 dark:text-gray-400">请检查URL是否正确或返回首页</p>
  21. </div>
  22. </div>
  23. <button
  24. onClick={() => navigate('/')}
  25. className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200 w-full"
  26. >
  27. 返回首页
  28. </button>
  29. </div>
  30. </div>
  31. </div>
  32. );
  33. };