From 9d6681ff94cf9fa671b9f2a34b471ffdbcaf07d8 Mon Sep 17 00:00:00 2001 From: CheeseB <2489ckckck@naver.com> Date: Mon, 1 Apr 2024 18:24:36 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20mock=20=EB=8D=B0=EC=9D=B4=ED=84=B0?= =?UTF-8?q?=20=EC=93=B0=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../postDetail/ImageSlide/index.tsx | 7 +++---- src/stories/ImageModal.stories.ts | 19 ------------------- 2 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 src/stories/ImageModal.stories.ts diff --git a/src/components/postDetail/ImageSlide/index.tsx b/src/components/postDetail/ImageSlide/index.tsx index 552a2612..55fcad22 100644 --- a/src/components/postDetail/ImageSlide/index.tsx +++ b/src/components/postDetail/ImageSlide/index.tsx @@ -7,7 +7,6 @@ import classNames from 'classnames/bind'; import { SVGS } from '@/constants'; import ImageModal from '@/components/postDetail/ImageModal'; -import { IMAGE_LIST } from '@/constants/mockData/imageList'; import useToggleButton from '@/hooks/useToggleButton'; import styles from './ImageSlide.module.scss'; @@ -23,7 +22,7 @@ type ImageSlideProps = { imageList?: string[]; }; -const ImageSlide = ({ imageList = IMAGE_LIST }: ImageSlideProps) => { +const ImageSlide = ({ imageList }: ImageSlideProps) => { const [selectedImageSrc, setSelectedImageSrc] = useState(''); const ref = useRef(null); const { isVisible, handleToggleClick } = useToggleButton(); @@ -41,7 +40,7 @@ const ImageSlide = ({ imageList = IMAGE_LIST }: ImageSlideProps) => { }; const handleImageClick = (index: number) => { - setSelectedImageSrc(imageList[index]); + setSelectedImageSrc(imageList?.[index] ?? ''); handleToggleClick(); }; @@ -55,7 +54,7 @@ const ImageSlide = ({ imageList = IMAGE_LIST }: ImageSlideProps) => {
- {imageList.map((item, index) => ( + {imageList?.map((item, index) => (