Skip to content

Commit

Permalink
fix: enable the infiniteLoop
Browse files Browse the repository at this point in the history
  • Loading branch information
0xShishigami committed Sep 25, 2024
1 parent b454693 commit b683dea
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/pages/landing/ContentSection/QuotesCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ import { useState } from 'react';
import { Carousel } from 'react-responsive-carousel';
import { styled } from 'styled-components';
import { FONT_MEDIUM, MOBILE_MAX_WIDTH } from '~/components';
import QUOTES_DATA from '~/data/quotes.json';

// simulate circular carousel
const QUOTES = [...QUOTES_DATA, ...QUOTES_DATA, ...QUOTES_DATA];
import QUOTES from '~/data/quotes.json';

export default function QuotesCarousel() {
const [selectedItem, setSelectedItem] = useState(Math.floor(QUOTES.length / 2));
const [selectedItem, setSelectedItem] = useState(1);

return (
<Container>
Expand All @@ -24,6 +21,7 @@ export default function QuotesCarousel() {
onChange={(index: number) => {
setSelectedItem(index);
}}
infiniteLoop
>
{QUOTES.map((quote, i) => (
<QuoteCard key={quote.author.name} data-previous={i === selectedItem - 1} data-next={i === selectedItem + 1}>
Expand Down

0 comments on commit b683dea

Please sign in to comment.