feat: allow closing dialogs by clicking backdrop

This commit is contained in:
hypercross 2026-07-08 00:35:01 +08:00
parent 2c2b7b781d
commit 03671583cd
2 changed files with 16 additions and 4 deletions

View File

@ -25,8 +25,14 @@ export const CreateSessionDialog: Component<CreateSessionDialogProps> = (
return ( return (
<Show when={props.open}> <Show when={props.open}>
<div class="absolute inset-0 z-50 flex items-center justify-center bg-black/20"> <div
<div class="bg-white rounded-lg border border-gray-200 shadow-xl w-[260px] p-4 space-y-3"> class="absolute inset-0 z-50 flex items-center justify-center bg-black/20"
onClick={props.onClose}
>
<div
class="bg-white rounded-lg border border-gray-200 shadow-xl w-[280px] p-4 space-y-3"
onClick={(e) => e.stopPropagation()}
>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<h3 class="text-sm font-semibold text-gray-800"></h3> <h3 class="text-sm font-semibold text-gray-800"></h3>
<button <button

View File

@ -37,8 +37,14 @@ export const InviteDialog: Component<InviteDialogProps> = (props) => {
}; };
return ( return (
<div class="absolute inset-0 z-50 flex items-center justify-center bg-black/20"> <div
<div class="bg-white rounded-lg border border-gray-200 shadow-xl w-[280px] p-4 space-y-3"> class="absolute inset-0 z-50 flex items-center justify-center bg-black/20"
onClick={props.onClose}
>
<div
class="bg-white rounded-lg border border-gray-200 shadow-xl w-[280px] p-4 space-y-3"
onClick={(e) => e.stopPropagation()}
>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<h3 class="text-sm font-semibold text-gray-800"></h3> <h3 class="text-sm font-semibold text-gray-800"></h3>
<button <button