diff --git a/src/components/informations/detail/ImageList.tsx b/src/components/informations/detail/ImageList.tsx index 5fc19940..67b70b59 100644 --- a/src/components/informations/detail/ImageList.tsx +++ b/src/components/informations/detail/ImageList.tsx @@ -1,7 +1,7 @@ import { useDragScrollType } from "@/hooks/useDragScroll"; import Image from "next/image"; import { Dispatch, SetStateAction } from "react"; -import ImageViewer from "./ImageViewer"; +import ImageViewerContainer from "@/containers/informations/detail/ImageViewerContainer"; interface Props { scrollHook: useDragScrollType; @@ -25,7 +25,15 @@ const ImageList = ({ return (
{viewerVisible && ( - + image.address !== mainImageUrl) + .map((image) => image.address), + ]} + closeViewer={closeViewer} + /> )}
>; closeViewer: () => void; } -const ImageViewer = ({ imageUrl, closeViewer }: Props) => { +const ImageViewer = ({ + imageUrls, + length, + index, + setIndex, + closeViewer, +}: Props) => { return ( -
+
-
+
closeViewer()} />
-
- image + setIndex((index + length - 1) % length)} + /> +
+ image +
+ setIndex((index + 1) % length)} />
+

{`${index + 1} / ${length}`}

); diff --git a/src/components/skeleton/common/TopListSkeleton.tsx b/src/components/skeleton/common/TopListSkeleton.tsx index b8bcc0a5..1fe2f142 100644 --- a/src/components/skeleton/common/TopListSkeleton.tsx +++ b/src/components/skeleton/common/TopListSkeleton.tsx @@ -5,7 +5,7 @@ interface Props { const TopListSkeleton = ({ title }: Props) => { return (
-

+

{`${title} 정보 `} Top 5

diff --git a/src/containers/informations/detail/ImageViewerContainer.tsx b/src/containers/informations/detail/ImageViewerContainer.tsx new file mode 100644 index 00000000..3f382068 --- /dev/null +++ b/src/containers/informations/detail/ImageViewerContainer.tsx @@ -0,0 +1,26 @@ +"use client"; + +import ImageViewer from "@/components/informations/detail/ImageViewer"; +import { useMemo, useState } from "react"; + +interface Props { + imageUrls: string[]; + closeViewer: () => void; +} + +const ImageViewerContainer = ({ imageUrls, closeViewer }: Props) => { + const [index, setIndex] = useState(0); + const length = useMemo(() => imageUrls.length, [imageUrls.length]); + + return ( + + ); +}; + +export default ImageViewerContainer; diff --git a/tailwind.config.ts b/tailwind.config.ts index fb34c9aa..8dd8f917 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -62,6 +62,10 @@ const config: Config = { "linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)", }, }, + arrow: { + from: { transform: "scale(1)" }, + to: { transform: "scale(1.5)" }, + }, }, animation: { sidebarFadeIn: "sidebarFadeIn 0.3s", @@ -73,6 +77,7 @@ const config: Config = { cardFlip: "cardFlip 0.5s linear", cardFlip2: "cardFlip2 0.5s linear", pulseAuth: "pulseAuth 2s cubic-bezier(0.4, 0, 0.6, 1) infinite", + arrow: "arrow 1s linear infinite alternate", }, }, },