This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ChevronLeft, ChevronRight} from 'lucide-react'; | |
import {useEffect, useState} from 'react'; | |
export function Pagination({carousel}: {carousel: HTMLElement}) { | |
// Scroll by 1 page in the given direction (-1 or +1). | |
// This uses the width of the carousel minus the padding and gap between items. | |
// Use behavior: 'smooth' and the browser will animate the scrolling. | |
let scroll = (dir: number) => { | |
let style = window.getComputedStyle(carousel); | |
carousel.scrollBy({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img { | |
position: relative; | |
display: block; | |
content: ""; | |
} | |
img:before { | |
display: block; | |
content: ""; | |
position: absolute; |