SettingModal.tsx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. "use client";
  2. export default function SettingModal({
  3. visible,
  4. onClose,
  5. }: {
  6. visible: boolean;
  7. onClose: () => void;
  8. }) {
  9. // 如果不显示,直接 return null
  10. if (!visible) return null;
  11. return (
  12. // 全屏遮罩
  13. <div className="fixed inset-0 z-50 bg-black/50">
  14. {/* 弹框主体 - 从底部滑上来 */}
  15. <div className="absolute bottom-0 left-0 right-0 w-full h-full bg-white rounded-t-2xl overflow-auto">
  16. <div className="flex flex-col">
  17. {/* 顶部导航 */}
  18. <header className="bg-black text-white py-4 px-4 flex items-center">
  19. <button onClick={onClose} className="mr-4">
  20. <svg
  21. xmlns="http://www.w3.org/2000/svg"
  22. className="h-6 w-6"
  23. fill="none"
  24. viewBox="0 0 24 24"
  25. stroke="currentColor"
  26. >
  27. <path
  28. strokeLinecap="round"
  29. strokeLinejoin="round"
  30. strokeWidth={2}
  31. d="M15 19l-7-7 7-7"
  32. />
  33. </svg>
  34. </button>
  35. <h1 className="text-lg font-medium">Setting</h1>
  36. </header>
  37. {/* 头像区域 */}
  38. <div className="bg-[#FFF5F0] py-8 flex flex-col items-center">
  39. <div className="w-20 h-20 bg-white rounded-full flex items-center justify-center border-2 border-black">
  40. <span className="text-black font-bold text-lg">LOGO</span>
  41. </div>
  42. </div>
  43. {/* 菜单列表 */}
  44. <div className="px-4 py-2">
  45. {/* Information */}
  46. <div className="py-4 border-b border-gray-100 flex justify-between items-center">
  47. <span className="text-black font-medium">Information</span>
  48. <svg
  49. xmlns="http://www.w3.org/2000/svg"
  50. className="h-5 w-5 text-gray-400"
  51. fill="none"
  52. viewBox="0 0 24 24"
  53. stroke="currentColor"
  54. >
  55. <path
  56. strokeLinecap="round"
  57. strokeLinejoin="round"
  58. strokeWidth={2}
  59. d="M9 5l7 7-7 7"
  60. />
  61. </svg>
  62. </div>
  63. {/* Subscribe 开关 */}
  64. <div className="py-4 border-b border-gray-100 flex justify-between items-center">
  65. <span className="text-black font-medium">Subscribe</span>
  66. <div className="relative w-12 h-6 rounded-full bg-black">
  67. <div className="absolute right-0.5 top-0.5 w-5 h-5 bg-white rounded-full"></div>
  68. </div>
  69. </div>
  70. {/* Log Out */}
  71. <div className="py-4 border-b border-gray-100">
  72. <button className="text-black font-medium w-full text-left">
  73. Log Out
  74. </button>
  75. </div>
  76. </div>
  77. {/* 版本号 */}
  78. <div className="py-6 text-center text-gray-400 text-sm">v1.1.0</div>
  79. </div>
  80. </div>
  81. </div>
  82. );
  83. }