Skip to content

Commit

Permalink
refactor: carousel height props 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
im-na0 committed Jul 12, 2024
1 parent 20cd58e commit c90a8df
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
8 changes: 1 addition & 7 deletions src/components/carousel/Carousel.style.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { PiCaretLeftBold, PiCaretRightBold } from "react-icons/pi";
import styled, { css } from "styled-components";

export const CarouselContainer = styled.div<{
$height: number;
}>`
export const CarouselContainer = styled.div`
position: relative;
min-height: ${(props) => `${props.$height}px`};
height: ${(props) => `${props.$height}px`};
overflow: hidden;
cursor: grab;
touch-action: pan-y;
`;
Expand Down
8 changes: 4 additions & 4 deletions src/components/carousel/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useCarousel } from "@/hooks/common/useCarousel";
import { useCarouselSize } from "@/hooks/common/useCarouselSize";

import * as S from "./Carousel.style.ts";
import ProgressiveImg from "../progressiveImg/ProgressiveImg.tsx";

import { useCarousel } from "@/hooks/common/useCarousel";
import { useCarouselSize } from "@/hooks/common/useCarouselSize";

interface CarouselProps {
images: string[];
height?: number;
Expand Down Expand Up @@ -41,7 +41,7 @@ const Carousel = ({
});
console.log("currentIndex", currentIndex);
return (
<S.CarouselContainer $height={height}>
<S.CarouselContainer>
<S.SliderWrapper>
<S.SliderContainer
ref={sliderRef}
Expand Down
7 changes: 4 additions & 3 deletions src/pages/homePage/itemCarousel/ItemCarousel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useAnimateCarousel } from "@/hooks/common/useAnimateCarousel";
import { useCarouselSize } from "@/hooks/common/useCarouselSize";
import { type LocaleItem } from "@/types/saleSection";
import { useEffect } from "react";

import * as S from "./ItemCarousel.style";
import ItemCarouselUnit from "./itemCarouselUnit/ItemCarouselUnit.tsx";

import { useAnimateCarousel } from "@/hooks/common/useAnimateCarousel";
import { useCarouselSize } from "@/hooks/common/useCarouselSize";
import { type LocaleItem } from "@/types/saleSection";

interface CarouselProps {
currentLocale: [number, string, LocaleItem[]];
localeAndHotel: [number, string, LocaleItem[]][];
Expand Down
9 changes: 1 addition & 8 deletions src/pages/homePage/weekendCarousel/WeekendCarousel.style.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { PiCaretLeftBold, PiCaretRightBold } from "react-icons/pi";
import styled, { css } from "styled-components";

export const CarouselContainer = styled.div<{
$height: number;
}>`
export const CarouselContainer = styled.div`
position: relative;
width: 100%;
min-height: ${(props) => `${props.$height}px`};
height: ${(props) => `${props.$height}px`};
background-color: white;
display: flex;
align-items: center;
gap: 8px;
cursor: grab;
touch-action: pan-y;
`;

Expand Down
4 changes: 1 addition & 3 deletions src/pages/homePage/weekendCarousel/WeekendCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface CarouselProps {
onChangeLocale: React.Dispatch<
React.SetStateAction<[number, string, LocaleItem[]]>
>;
height?: number;
arrows?: boolean;
infinite?: boolean;
draggable?: boolean;
Expand All @@ -20,7 +19,6 @@ interface CarouselProps {

const WeekendCarousel = ({
weekendHotels,
height = 300,
arrows = true,
infinite = false,
draggable = false,
Expand All @@ -41,7 +39,7 @@ const WeekendCarousel = ({
});

return (
<S.CarouselContainer $height={height}>
<S.CarouselContainer>
<S.SliderWrapper>
<S.SliderContainer
ref={sliderRef}
Expand Down

0 comments on commit c90a8df

Please sign in to comment.