From 5af93fbbcbc757c57566d2c74f9012c5029fc393 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 3 Jan 2025 12:27:40 +0530 Subject: [PATCH] Testing smooth anim --- web/apps/photos/src/pages/index.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx index 53b5a558cb..ee960bc714 100644 --- a/web/apps/photos/src/pages/index.tsx +++ b/web/apps/photos/src/pages/index.tsx @@ -328,8 +328,12 @@ const Slideshow: React.FC = () => { }); useEffect(() => { + console.log( + "scroll to", + containerRef.current!.offsetWidth * selectedIndex, + ); containerRef.current.scrollTo({ - left: containerRef.current.offsetWidth * selectedIndex, + left: containerRef.current!.offsetWidth * selectedIndex, }); }, [selectedIndex]); @@ -381,7 +385,7 @@ const Slideshow: React.FC = () => { - + {/* - + */} ); }; @@ -403,14 +407,14 @@ const SlidesContainer = styled("div")` display: flex; overflow-x: hidden; scroll-behavior: smooth; - & > div { - flex: 0 0 100%; - } + // scroll-snap-type: x mandatory; `; const Slide = styled(Stack)` + flex: 0 0 100%; align-items: center; text-align: center; + // scroll-snap-align: start; `; const TextContainer = (props: TypographyProps) => (