feat(ui): add click-outside to close functionality for settings modal
- Restructure modal overlay to separate backdrop and content layers - Add onMouseDown handler to close modal when clicking outside - Improve backdrop styling with blur effect
This commit is contained in:
@@ -157,8 +157,14 @@ export default function SettingsModal({ onClose }: SettingsModalProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="fixed inset-0 bg-black/50 dark:bg-black/70 flex items-center justify-center z-50">
|
<div
|
||||||
<div className="bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-[500px] overflow-hidden">
|
className="fixed inset-0 z-50 flex items-center justify-center"
|
||||||
|
onMouseDown={(e) => {
|
||||||
|
if (e.target === e.currentTarget) onClose();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="absolute inset-0 bg-black/50 dark:bg-black/70 backdrop-blur-sm" />
|
||||||
|
<div className="relative bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-[500px] overflow-hidden">
|
||||||
{/* 标题栏 */}
|
{/* 标题栏 */}
|
||||||
<div className="flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800">
|
<div className="flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800">
|
||||||
<h2 className="text-lg font-semibold text-blue-500 dark:text-blue-400">
|
<h2 className="text-lg font-semibold text-blue-500 dark:text-blue-400">
|
||||||
|
|||||||
Reference in New Issue
Block a user