Skip to content

Commit

Permalink
style: 스타일 조정
Browse files Browse the repository at this point in the history
  • Loading branch information
solar3070 committed Dec 3, 2023
1 parent 5a460be commit ab5be83
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/hooks/useInfiniteCarousel.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { useEffect, useRef, useState } from 'react';

const useInfiniteCarousel = <T>(carouselList: Array<T>, x: string) => {
const TOTAL_SLIDE = carouselList.length;
const [infiniteCarouselList, setInfiniteCarouselList] = useState(carouselList);
const [currentIndex, setCurrentIndex] = useState(1);
const [currentIndex, setCurrentIndex] = useState(0);
const carouselRef = useRef<HTMLDivElement>(null);
const TOTAL_SLIDE = carouselList.length;

useEffect(() => {
const firstSide = carouselList[0];
const lastSlide = carouselList[TOTAL_SLIDE - 1];
setInfiniteCarouselList([lastSlide, ...carouselList, firstSide]);
setCurrentIndex(1);
}, [carouselList, TOTAL_SLIDE]);

const moveToNthSlide = (index: number) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function PartSlide({ part, handleCarouselSwipe }: PartSlideProps)
visible: {
opacity: 1,
y: 0,
transition: { opacity: { delay: 0.2, duration: 0.6 }, y: { delay: 0.2, duration: 1 } },
transition: { opacity: { delay: 0.4, duration: 0.6 }, y: { delay: 0.4, duration: 1 } },
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const PartSlide = styled.div`
flex-shrink: 0;
position: relative;
width: 100vw;
width: 100%;
height: 428px;
padding: 77px 0 62px 0;
Expand Down
2 changes: 1 addition & 1 deletion src/views/MainPage/components/PartConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function PartConfig() {
const [partIndex, setPartIndex] = useState(0);
const { carouselRef, infiniteCarouselList, handleSwipe } = useInfiniteCarousel<TabType>(
carouselList,
'(-100vw - 20px)',
'(-100% - 20px)',
);

const handleSelectPart = (clickedIndex: number) => {
Expand Down
2 changes: 1 addition & 1 deletion src/views/MainPage/components/PartConfig/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const PartButtonList = styled.div`
`;

export const CarouselWrapper = styled.div`
width: 100vw;
width: 100%;
overflow: hidden;
`;

Expand Down

0 comments on commit ab5be83

Please sign in to comment.