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.

fix(ui): modal scrolling behavior on mobile

unrenamed526ede6df7f5
diff --git a/apps/web/ui/modals/add-edit-domain-modal.tsx b/apps/web/ui/modals/add-edit-domain-modal.tsx
index 5daaf4b4de..5413fa77a1 100644
--- a/apps/web/ui/modals/add-edit-domain-modal.tsx
+++ b/apps/web/ui/modals/add-edit-domain-modal.tsx
@@ -36,7 +36,7 @@ function AddEditDomainModal({
<Modal
showModal={showAddEditDomainModal}
setShowModal={setShowAddEditDomainModal}
- className="scrollbar-hide h-fit max-h-[95vh] overflow-auto"
+ className="h-fit max-h-[95vh]"
>
<div className="flex flex-col items-center justify-center gap-y-3 border-b border-gray-200 px-4 py-4 pt-8 sm:px-16">
{logo ? (
diff --git a/apps/web/ui/modals/add-edit-token-modal.tsx b/apps/web/ui/modals/add-edit-token-modal.tsx
index c31274782c..4bd1c9c908 100644
--- a/apps/web/ui/modals/add-edit-token-modal.tsx
+++ b/apps/web/ui/modals/add-edit-token-modal.tsx
@@ -146,7 +146,7 @@ function AddEditTokenModal({
<Modal
showModal={showAddEditTokenModal}
setShowModal={setShowAddEditTokenModal}
- className="scrollbar-hide h-fit max-h-[95vh] overflow-auto"
+ className="h-fit max-h-[95vh]"
>
<div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-4 pt-8 sm:px-16">
{logo ? (
diff --git a/apps/web/ui/modals/send-test-webhook-modal.tsx b/apps/web/ui/modals/send-test-webhook-modal.tsx
index 6d2b05bba9..6f2b4b552a 100644
--- a/apps/web/ui/modals/send-test-webhook-modal.tsx
+++ b/apps/web/ui/modals/send-test-webhook-modal.tsx
@@ -53,7 +53,6 @@ function SendTestWebhookModal({
<Modal
showModal={showSendTestWebhookModal}
setShowModal={setShowSendTestWebhookModal}
- className="overflow-visible"
>
<div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-4 pt-8 text-center sm:px-16">
<Logo />
diff --git a/apps/web/ui/modals/transfer-domain-modal.tsx b/apps/web/ui/modals/transfer-domain-modal.tsx
index 94e7bafa9b..1f78c39519 100644
--- a/apps/web/ui/modals/transfer-domain-modal.tsx
+++ b/apps/web/ui/modals/transfer-domain-modal.tsx
@@ -67,7 +67,6 @@ function TransferDomainModal({
<Modal
showModal={showTransferDomainModal}
setShowModal={setShowTransferDomainModal}
- className="overflow-visible"
>
<form
onSubmit={async (e) => {
diff --git a/apps/web/ui/modals/transfer-link-modal.tsx b/apps/web/ui/modals/transfer-link-modal.tsx
index 32554b6e71..789fd05b79 100644
--- a/apps/web/ui/modals/transfer-link-modal.tsx
+++ b/apps/web/ui/modals/transfer-link-modal.tsx
@@ -36,7 +36,6 @@ function TransferLinkModal(props: TransferLinkModalProps) {
<Modal
showModal={props.showTransferLinkModal}
setShowModal={props.setShowTransferLinkModal}
- className="overflow-visible"
>
<TransferLinkModalInner {...props} />
</Modal>
diff --git a/packages/ui/src/modal.tsx b/packages/ui/src/modal.tsx
index 313999f284..74ba7fbe25 100644
--- a/packages/ui/src/modal.tsx
+++ b/packages/ui/src/modal.tsx
@@ -61,18 +61,18 @@ export function Modal({
<Drawer.Overlay className="fixed inset-0 z-50 bg-gray-100 bg-opacity-10 backdrop-blur" />
<Drawer.Content
className={cn(
- "fixed bottom-0 left-0 right-0 z-50 rounded-t-[10px] border-t border-gray-200 bg-white",
+ "fixed bottom-0 left-0 right-0 z-50 flex flex-col rounded-t-[10px] border-t border-gray-200 bg-white",
className,
)}
>
- <VisuallyHidden.Root>
- <Drawer.Title>Modal</Drawer.Title>
- <Drawer.Description>This is a modal</Drawer.Description>
- </VisuallyHidden.Root>
- <div className="sticky top-0 z-20 flex w-full items-center justify-center rounded-t-[10px] bg-inherit">
- <div className="my-3 h-1 w-12 rounded-full bg-gray-300" />
+ <div className="scrollbar-hide flex-1 overflow-y-auto rounded-t-[10px] bg-inherit">
+ <VisuallyHidden.Root>
+ <Drawer.Title>Modal</Drawer.Title>
+ <Drawer.Description>This is a modal</Drawer.Description>
+ </VisuallyHidden.Root>
+ <DrawerIsland />
+ {children}
</div>
- {children}
</Drawer.Content>
<Drawer.Overlay />
</Drawer.Portal>
@@ -113,3 +113,11 @@ export function Modal({
</Dialog.Root>
);
}
+
+function DrawerIsland() {
+ return (
+ <div className="sticky top-0 z-20 flex items-center justify-center rounded-t-[10px] bg-inherit">
+ <div className="my-3 h-1 w-12 rounded-full bg-gray-300" />
+ </div>
+ );
+}