Skip to content

Commit

Permalink
Fix: PCardSlider의 요소 너비 수정
Browse files Browse the repository at this point in the history
- PCardSlider의 너비를 %로 줬을 때, PCard의 너비도 %로 적용되는 것 수정
- 주어진 width의 형식을 확인하고 형식에 따라 PCard의 너비를 다르게 적용해줌
  • Loading branch information
thsk3 committed Oct 2, 2024
1 parent a5772dc commit a09c70d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/PCardSlider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export const PCardSlider = ({ pList, width = '100%', isRanked }: PCardSliderProp
slidesToScroll: 1,
swipeToSlide: true,
};
const widthType = width.match(/[^0-9]/g)?.join('');
const PCardWidth = widthType === '%' ? '98%' : `calc(${width} / 5.2)`;
return (
<S.PCardSlider width={width}>
<Slider {...settings}>
{pList.map((perform, index) => {
return (
<PCard key={index} pInfo={perform} width={`calc(${width} / 5.2)`} {...(isRanked && { rank: index + 1 })} />
);
return <PCard key={index} pInfo={perform} width={PCardWidth} {...(isRanked && { rank: index + 1 })} />;
})}
</Slider>
</S.PCardSlider>
Expand Down

0 comments on commit a09c70d

Please sign in to comment.