Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Adding back @Snazzah's changes

Steven Tey02b5e9ad70d6
diff --git a/components/shared/modal.tsx b/components/shared/modal.tsx
index 74ed46c287..c4098c214b 100644
--- a/components/shared/modal.tsx
+++ b/components/shared/modal.tsx
@@ -22,6 +22,7 @@ export default function Modal({
const router = useRouter();
const { key } = router.query;
const mobileModalRef = useRef(null);
+ const desktopModalRef = useRef(null);
const closeModal = useCallback(() => {
if (key) {
@@ -90,11 +91,15 @@ export default function Modal({
{children}
</motion.div>
<motion.div
+ ref={desktopModalRef}
key="desktop-modal"
- className="fixed inset-0 z-40 min-h-screen px-4 hidden sm:flex items-center justify-center"
+ className="fixed inset-0 z-40 min-h-screen hidden sm:flex items-center justify-center"
initial={{ scale: 0.95 }}
animate={{ scale: 1 }}
exit={{ scale: 0.95 }}
+ onClick={(e) => {
+ if (desktopModalRef.current === e.target) closeModal();
+ }}
>
{children}
</motion.div>