Skip to content

Commit

Permalink
chore: comment for magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Grund committed Nov 27, 2024
1 parent 838199b commit 9810ae8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Carousel/CarouselDots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const CarouselDots = forwardRef<HTMLDivElement, CarouselDotsProps>(

const scrollToDot = useCallback((index: number) => {
if (scrollableContainerRef.current) {
scrollableContainerRef.current.scrollTo({
scrollableContainerRef.current.scrollTo?.({
// 8 + 12 = width of dot plus gap
left: index * (8 + 12) - scrollableContainerRef.current.offsetWidth / 2 + 10, // Center dot in container
behavior: 'smooth',
});
Expand Down

0 comments on commit 9810ae8

Please sign in to comment.