Limit carousel to display a maximum of nine articles
Limit the featured carousel component to display a maximum of 9 articles by adjusting the calculation of total pages. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 517dfa7b-26ac-463d-a6e1-a58c6df97188 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 8540f9f1-6f09-452c-b0ec-6b5b0821231b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/517dfa7b-26ac-463d-a6e1-a58c6df97188/0ZGabQy Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
9cdbdb35ac
commit
901d69965f
@ -326,7 +326,7 @@ function FeaturedHeroCard({ article, focalPoints }: { article: Article; focalPoi
|
||||
|
||||
function FeaturedCarousel({ articles, popular, galleryImages, focalPoints }: { articles: Article[]; popular?: Article[]; galleryImages?: GalleryImage[]; focalPoints?: Record<string, { x: number; y: number }> }) {
|
||||
const pageSize = 3;
|
||||
const totalPages = Math.max(1, Math.ceil(articles.length / pageSize));
|
||||
const totalPages = Math.max(1, Math.ceil(Math.min(articles.length, 9) / pageSize));
|
||||
const [page, setPage] = useState(0);
|
||||
const [paused, setPaused] = useState(false);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user