@@ -59,10 +59,25 @@ export default function Home() {
5959 }
6060 } ;
6161
62- // Scroll to the right end (newest images) on mount and window resize
62+ // Scroll functions for arrow buttons
63+ const scrollLeft = ( ) => {
64+ const scrollContainer = document . getElementById ( "image-scroll-container" ) ;
65+ if ( scrollContainer ) {
66+ scrollContainer . scrollBy ( { left : - 300 , behavior : "smooth" } ) ;
67+ }
68+ } ;
69+
70+ const scrollRight = ( ) => {
71+ const scrollContainer = document . getElementById ( "image-scroll-container" ) ;
72+ if ( scrollContainer ) {
73+ scrollContainer . scrollBy ( { left : 300 , behavior : "smooth" } ) ;
74+ }
75+ } ;
76+
77+ // Only scroll on window resize, not on initial load
6378 useEffect ( ( ) => {
64- // Initial scroll
65- setTimeout ( scrollToRight , 1 ) ;
79+ // Initial scroll to show newest images
80+ setTimeout ( scrollToRight , 100 ) ;
6681
6782 // Add resize listener
6883 window . addEventListener ( "resize" , scrollToRight ) ;
@@ -245,7 +260,7 @@ export default function Home() {
245260 < h1 className = "p-1 text-3xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent" >
246261 AI Image Editor
247262 </ h1 >
248- < p className = "text-gray-100 mt-1" >
263+ < p className = "text-gray-100 mt-1 text-sm sm:text-base " >
249264 Transform your images with AI-powered editing
250265 </ p >
251266 </ div >
@@ -259,8 +274,8 @@ export default function Home() {
259274 Your Gallery
260275 </ h2 >
261276 { selectedImages . size === 0 ? (
262- < p className = "text-sm text-gray-400" >
263- Click to select images for editing
277+ < p className = "text-sm text-gray-400 text-right " >
278+ Select images for editing
264279 </ p >
265280 ) : (
266281 < div className = "bg-blue-600/20 backdrop-blur-xl rounded-xl px-3 border border-blue-500/30" >
@@ -272,24 +287,44 @@ export default function Home() {
272287 ) }
273288 </ div >
274289
275- < div
276- className = "w-full overflow-x-auto minimal-scrollbar"
277- id = "image-scroll-container"
278- >
279- < div className = "flex gap-6 px-2 py-4" >
280- { images . map ( ( image ) => (
281- < ImageCard
282- key = { image . id }
283- image = { image }
284- isSelected = { selectedImages . has ( image . id ) }
285- fallbackImageUrl = { null }
286- onSelect = { handleImageSelection }
287- />
288- ) ) }
289- { /* add some space at the end to not interfere with ImageCard hover animation */ }
290- < div > -</ div >
290+ < div className = "relative" >
291+ < div
292+ className = "w-full overflow-x-auto minimal-scrollbar"
293+ id = "image-scroll-container"
294+ >
295+ < div className = "flex gap-6 px-2 py-4" >
296+ { images . map ( ( image ) => (
297+ < ImageCard
298+ key = { image . id }
299+ image = { image }
300+ isSelected = { selectedImages . has ( image . id ) }
301+ fallbackImageUrl = { null }
302+ onSelect = { handleImageSelection }
303+ />
304+ ) ) }
305+ { /* add some space at the end to not interfere with ImageCard hover animation */ }
306+ < div className = "hidden sm:block" > -</ div >
307+ </ div >
291308 </ div >
292309 </ div >
310+
311+ { /* Arrow Navigation Buttons */ }
312+ < div className = "flex justify-center mt-4 gap-16" >
313+ < button
314+ onClick = { scrollLeft }
315+ className = "text-2xl text-gray-400 hover:text-white transition-colors duration-200 font-bold"
316+ aria-label = "Scroll left"
317+ >
318+ <
319+ </ button >
320+ < button
321+ onClick = { scrollRight }
322+ className = "text-2xl text-gray-400 hover:text-white transition-colors duration-200 font-bold"
323+ aria-label = "Scroll right"
324+ >
325+ >
326+ </ button >
327+ </ div >
293328 </ div >
294329
295330 { /* Chat Interface */ }
0 commit comments