Skip to content

Commit

Permalink
fix: routing error bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
moong23 committed Jul 16, 2023
1 parent 6ee7882 commit 706bb53
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import "swiper/css";
import "swiper/css/effect-coverflow";
import "swiper/css/navigation";
import BrandMoodButton from "@/components/BrandMoodButton";
import { useNavigate } from "react-router-dom";

interface BrandIconProps {
name: string;
}

const Carousel = () => {
const navigate = useNavigate();
const swiperRef = useRef<SwiperRef>(null);
const [currentSlide, setCurrentSlide] = useState<number>(0);

Expand All @@ -31,6 +33,10 @@ const Carousel = () => {
return <BrandIcon name={name} />;
};

const handleSlideClick = () => {
navigate("/brand/1");
};

return (
<>
<Swiper
Expand Down Expand Up @@ -75,7 +81,10 @@ const Carousel = () => {
id={tagId}
>
<div className="slide-wrapper">
<CarouselImgDiv imgSrc={data.imgSrc}>
<CarouselImgDiv
imgSrc={data.imgSrc}
onClick={handleSlideClick}
>
{currentSlide === slideId && (
<>
<CarouselIconDiv>
Expand Down Expand Up @@ -158,5 +167,5 @@ const CarouselBrandMoodDiv = styled.div`
left: 1.667vw;
gap: 0.521vw;
display: flex;
flex-dirction: row;
flex-direction: row;
`;

0 comments on commit 706bb53

Please sign in to comment.