@@ -54,8 +54,8 @@ export const Modal: FC<Props> = ({
54
54
55
55
trackEvent ( "modal_dismiss" , {
56
56
manner,
57
- title : title ,
58
- specify : specify ,
57
+ title,
58
+ specify,
59
59
path : window . location . pathname ,
60
60
} ) ;
61
61
} ,
@@ -82,13 +82,19 @@ export const Modal: FC<Props> = ({
82
82
tabIndex = { 0 }
83
83
>
84
84
{ /* Modal outer-container for positioning */ }
85
- < div className = "pointer-events-none relative h-[calc(100%-1rem)] w-auto min-[576px]:mx-auto min-[576px]:mt-7 min-[576px]:h-[calc(100%-3.5rem)] min-[576px]:max-w-[500px]" >
85
+ < div
86
+ className = { cn (
87
+ "pointer-events-none relative" ,
88
+ "h-dvh w-auto" , // small screens
89
+ "min-[576px]:mx-auto min-[576px]:mt-7 min-[576px]:h-[calc(100%-3.5rem)] min-[576px]:max-w-[500px]" , // large screens
90
+ ) }
91
+ >
86
92
< FocusOn
87
93
autoFocus = { autoFocus }
88
94
onClickOutside = { handleClickOutside }
89
95
onEscapeKey = { handleEscape }
90
96
focusLock = { ! disableFocusLock }
91
- className = "relative max-h-[100%] w-full"
97
+ className = "relative max-h-full h-full w-full"
92
98
>
93
99
{ /* Visible Modal */ }
94
100
< div
@@ -97,7 +103,7 @@ export const Modal: FC<Props> = ({
97
103
"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 outline-none" ,
98
104
"p-6 text-left" ,
99
105
"filter drop-shadow-xl" ,
100
- "rounded-none sm :rounded-xl" ,
106
+ "rounded-none min-[576px] :rounded-xl" ,
101
107
className ,
102
108
) }
103
109
role = "dialog"
@@ -143,11 +149,18 @@ const MaybeWithForm: FC<MaybeWithFormProps> = ({ onSubmit, disabled, children })
143
149
) ;
144
150
145
151
if ( ! onSubmit ) {
146
- return < > { children } </ > ;
152
+ return (
153
+ < div className = "flex flex-col max-h-[calc(100dvh-3rem)] min-[576px]:max-h-[calc(100dvh-6rem)]" >
154
+ { children }
155
+ </ div >
156
+ ) ;
147
157
}
148
158
149
159
return (
150
- < form onSubmit = { handleSubmit } >
160
+ < form
161
+ onSubmit = { handleSubmit }
162
+ className = "flex flex-col max-h-[calc(100dvh-3rem)] min-[576px]:max-h-[calc(100dvh-6rem)]"
163
+ >
151
164
{ /* including a hidden submit button ensures submit on enter works despite a button w/ type="submit" existing or not */ }
152
165
< input type = "submit" className = "hidden" hidden disabled = { disabled } />
153
166
{ children }
@@ -161,7 +174,7 @@ type ModalHeaderProps = {
161
174
162
175
export const ModalHeader : FC < ModalHeaderProps > = ( { children } ) => {
163
176
return (
164
- < Heading2 id = "modal-header" className = "pb-2" >
177
+ < Heading2 id = "modal-header" className = "pb-2 shrink-0 " >
165
178
{ children }
166
179
</ Heading2 >
167
180
) ;
@@ -177,7 +190,7 @@ export const ModalBody: FC<ModalBodyProps> = ({ children, hideDivider = false })
177
190
// Allows the first tabbable element in the body to receive focus on mount
178
191
< AutoFocusInside
179
192
className = { cn (
180
- "md :flex-grow relative border-gray-200 dark:border-gray-800 -mx-6 px-6 pb-6 overflow-y-auto" ,
193
+ "flex-grow min-[576px] :flex-grow-0 relative border-gray-200 dark:border-gray-800 -mx-6 px-6 pb-6 overflow-y-auto" ,
181
194
{
182
195
"border-t border-b mt-2 py-4" : ! hideDivider ,
183
196
} ,
@@ -200,7 +213,7 @@ export const ModalFooter: FC<ModalFooterProps> = ({ className, alert, children }
200
213
< div
201
214
className = { classNames (
202
215
// causes footer to show up on top of alert
203
- "relative" ,
216
+ "relative shrink-0 " ,
204
217
// make as wide as the modal so it covers the alert
205
218
"-mx-6 -mb-6 p-6" ,
206
219
// apply the same bg and rounded corners as the modal
0 commit comments