@@ -161,76 +161,78 @@ export default function Gallery() {
161161
162162 return (
163163 < PageTransition >
164- < Heading
165- text = "Gallery"
166- className = "text-center absolute top-0 left-0 right-0 mb-24"
167- />
168- < div className = "grid grid-cols-2 md:grid-cols-3 gap-4 m-[5%]" >
169- { images . map ( ( image , index ) => (
170- < div
171- role = "button"
172- aria-label = "Open"
173- onClick = { ( ) => openModal ( index ) }
174- onKeyDown = { ( e ) => {
175- if ( e . key === "Enter" || e . key === " " ) {
176- openModal ( index ) ;
177- }
178- } }
179- tabIndex = { 0 } // Makes the div focusable
180- key = { image . src }
181- className = "cursor-pointer"
182- >
183- < img
184- className = "h-auto max-w-full rounded-lg aspect-square"
185- src = { image . src }
186- alt = { `Gallery img ${ index + 1 } ` }
187- />
188- </ div >
189- ) ) }
190-
191- { modalOpen ? (
192- < div className = "fixed inset-0 flex items-center justify-center z-50 bg-black bg-opacity-75 overflow-y-auto" >
193- < div className = "relative max-h-screen max-w-screen-lg p-4 bg-white rounded-lg" >
194- < button
195- type = "button"
196- className = "absolute top-0 right-0 m-4 text-white bg-gray-500 hover:bg-gray-700 font-bold py-2 px-4 border border-gray-700 rounded"
197- onClick = { closeModal }
198- aria-label = "Close"
199- >
200- x
201- </ button >
202- < button
203- className = "absolute left-0 top-1/2 transform -translate-y-1/2 text-black font-bold py-2 px-4 border border-black rounded-3xl ml-5"
204- onClick = { goToPrevious }
205- aria-label = "Previous Image"
206- type = "button"
207- >
208- <<
209- </ button >
210- < button
211- className = "absolute right-0 top-1/2 transform -translate-y-1/2 text-black font-bold py-2 px-4 border border-black rounded-3xl mr-5"
212- onClick = { goToNext }
213- aria-label = "Next Image"
214- type = "button"
215- >
216- >>
217- </ button >
164+ < div className = "pt-8 pb-16" >
165+ < Heading
166+ text = "Gallery"
167+ className = "text-center absolute top-0 left-0 right-0 mb-12 md:mb-24"
168+ />
169+ < div className = "grid grid-cols-2 md:grid-cols-3 gap-4 m-[5%]" >
170+ { images . map ( ( image , index ) => (
171+ < div
172+ role = "button"
173+ aria-label = "Open"
174+ onClick = { ( ) => openModal ( index ) }
175+ onKeyDown = { ( e ) => {
176+ if ( e . key === "Enter" || e . key === " " ) {
177+ openModal ( index ) ;
178+ }
179+ } }
180+ tabIndex = { 0 } // Makes the div focusable
181+ key = { image . src }
182+ className = "cursor-pointer"
183+ >
218184 < img
219- className = "max-h-[80vh] max-w-[80vw] rounded-lg mb-4 "
220- src = { images [ selectedImageIndex ] . src }
221- alt = { `Selected gallery img ${ selectedImageIndex + 1 } ` }
185+ className = "h-auto max-w-full rounded-lg aspect-square "
186+ src = { image . src }
187+ alt = { `Gallery img ${ index + 1 } ` }
222188 />
223- < div className = "text-center max-w-[80vw]" >
224- < h3 className = "text-lg font-semibold truncate" >
225- { images [ selectedImageIndex ] . caption }
226- </ h3 >
227- < p className = "text-sm text-gray-500" >
228- Date: { images [ selectedImageIndex ] . date }
229- </ p >
189+ </ div >
190+ ) ) }
191+
192+ { modalOpen ? (
193+ < div className = "fixed inset-0 flex items-center justify-center z-50 bg-black bg-opacity-75 overflow-y-auto" >
194+ < div className = "relative max-h-screen max-w-screen-lg p-4 bg-white rounded-lg" >
195+ < button
196+ type = "button"
197+ className = "absolute top-0 right-0 m-4 text-white bg-gray-500 hover:bg-gray-700 font-bold py-2 px-4 border border-gray-700 rounded"
198+ onClick = { closeModal }
199+ aria-label = "Close"
200+ >
201+ x
202+ </ button >
203+ < button
204+ className = "absolute left-0 top-1/2 transform -translate-y-1/2 text-black font-bold py-2 px-4 border border-black rounded-3xl ml-5"
205+ onClick = { goToPrevious }
206+ aria-label = "Previous Image"
207+ type = "button"
208+ >
209+ <<
210+ </ button >
211+ < button
212+ className = "absolute right-0 top-1/2 transform -translate-y-1/2 text-black font-bold py-2 px-4 border border-black rounded-3xl mr-5"
213+ onClick = { goToNext }
214+ aria-label = "Next Image"
215+ type = "button"
216+ >
217+ >>
218+ </ button >
219+ < img
220+ className = "max-h-[80vh] max-w-[80vw] rounded-lg mb-4"
221+ src = { images [ selectedImageIndex ] . src }
222+ alt = { `Selected gallery img ${ selectedImageIndex + 1 } ` }
223+ />
224+ < div className = "text-center max-w-[80vw]" >
225+ < h3 className = "text-lg font-semibold truncate" >
226+ { images [ selectedImageIndex ] . caption }
227+ </ h3 >
228+ < p className = "text-sm text-gray-500" >
229+ Date: { images [ selectedImageIndex ] . date }
230+ </ p >
231+ </ div >
230232 </ div >
231233 </ div >
232- </ div >
233- ) : null }
234+ ) : null }
235+ </ div >
234236 </ div >
235237 </ PageTransition >
236238 ) ;
0 commit comments