diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f650315 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules + +# next.js +/.next/ +/out/ + +# production +/build + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# env files +.env* + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts \ No newline at end of file diff --git a/app/basket/page.tsx b/app/basket/page.tsx new file mode 100644 index 0000000..6b22423 --- /dev/null +++ b/app/basket/page.tsx @@ -0,0 +1,111 @@ +"use client"; + +import { useBasket } from "@/contexts/basket-context"; +import { ImageIcon } from "lucide-react"; + +export default function Component() { + const { basketItems } = useBasket(); + + const slotsPerFrame = 4; + const framesPerRow = 2; + const slotsPerRow = slotsPerFrame * framesPerRow; + const totalRows = Math.ceil(Math.max(8, basketItems.length) / slotsPerRow); + + // 각 슬롯 index에 해당하는 pose를 결정하는 로직 (열 위치를 기준) + const getPoseForSlot = (slotIndex: number) => { + const columnIndex = slotIndex % slotsPerFrame; + return basketItems[columnIndex] ?? null; + }; + + const renderPhotoSlot = (index: number) => { + const pose = getPoseForSlot(index); + const imageUrl = pose?.imageUrl; + + return ( +
+ {imageUrl ? ( + {`선택된 + ) : ( + + phoTo + + )} +
+ ); + }; + + const renderFramePair = (rowIndex: number) => { + const startIndex = rowIndex * slotsPerRow; + + return ( +
+ {/* 왼쪽 프레임 */} +
+
+ {Array.from({ length: slotsPerFrame }, (_, i) => + renderPhotoSlot(startIndex + i) + )} +
+
+ + {/* 오른쪽 프레임 */} +
+
+ {Array.from({ length: slotsPerFrame }, (_, i) => + renderPhotoSlot(startIndex + slotsPerFrame + i) + )} +
+
+
+ ); + }; + + return ( +
+ {/* 배경 수달 이미지 */} +
+ Otter illustration background +
+ + {/* 상단 헤더 */} +
+
+

+ 내 장바구니 +

+
+ +

+ 저장된 포즈 사진들 +

+
+
+
+ + {/* 포토 슬롯 렌더링 */} +
+
+ {Array.from({ length: totalRows }, (_, rowIndex) => + renderFramePair(rowIndex) + )} +
+
+
+ ); +} + + + +