Skip to content

Commit

Permalink
Merge pull request #302 from KakaoFunding/bug/299
Browse files Browse the repository at this point in the history
Bug/299
  • Loading branch information
devkyoung2 authored May 26, 2024
2 parents 7fa29be + 6369ad7 commit 0649d1e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
12 changes: 1 addition & 11 deletions src/layouts/Product/DetailMain/ProductCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ import styles from './ProductCarousel.module.scss';
import './ProductCarousel.css';

type ProductCarouselProps = {
// TODO : 타입
// imgs : [{id : number; url : 'string'}]
thumbnails: string[];
className: string;
};

// TODO : 타입
const ProductCarousel = ({ thumbnails, className }: ProductCarouselProps) => {
const [target, setTarget] = useState(0);

Expand Down Expand Up @@ -45,14 +42,7 @@ const ProductCarousel = ({ thumbnails, className }: ProductCarouselProps) => {
className={className}
>
{thumbnails.map((img) => (
<img
// TODO : 타입
// key : img.id
key={img}
// key : img.url
src={img}
alt="상품 대표 이미지"
/>
<img key={img} src={img} alt="상품 대표 이미지" />
))}
</Slider>
)
Expand Down
17 changes: 13 additions & 4 deletions src/layouts/Product/DetailMain/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,19 @@ const DetailMain = ({ productDescription }: DetailMainProps) => {
} = productDescription;
return (
<section className={styles.area_main}>
<ProductCarousel
thumbnails={productThumbnails}
className={styles.carousel}
/>
{productThumbnails.length > 1 && (
<ProductCarousel
thumbnails={productThumbnails}
className={styles.carousel}
/>
)}
{productThumbnails.length === 1 && (
<img
src={productThumbnails[0]}
alt={`${productName}상품이미지`}
className={styles.carousel}
/>
)}
<section className={styles.wrapper_info}>
<section className={styles.desc_prod}>
<div className={styles.title}>{productName}</div>
Expand Down

0 comments on commit 0649d1e

Please sign in to comment.