Skip to content

Commit a665244

Browse files
authored
Merge pull request #51 from codeit-2team/feat/48
feat/48 레이아웃분리/상세페이지 타이틀,이미지그리드 컴포넌트 구현/배포에러잡히는 부분 수정
2 parents 0955294 + 5a79241 commit a665244

File tree

17 files changed

+321
-17
lines changed

17 files changed

+321
-17
lines changed

public/assets/svg/dropdown.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react';
2+
3+
interface IconBellProps extends React.SVGProps<SVGSVGElement> {
4+
size?: number;
5+
color?: string;
6+
}
7+
8+
const IconDropdown = ({ size = 64, color = '#000', ...props }) => (
9+
<svg
10+
width={size}
11+
height={size}
12+
viewBox='0 0 52 52'
13+
fill={color}
14+
xmlns='http://www.w3.org/2000/svg'
15+
{...props}
16+
>
17+
<path
18+
fill='#535358'
19+
d='M16 10a2 2 0 100-4 2 2 0 000 4zM16 18a2 2 0 100-4 2 2 0 000 4zM16 26a2 2 0 100-4 2 2 0 000 4z'
20+
/>
21+
</svg>
22+
);
23+
24+
export default IconDropdown;

public/test/image1.png

2.37 MB
Loading

public/test/image2.png

980 KB
Loading

public/test/image3.png

396 KB
Loading

public/test/image4.png

1.38 MB
Loading

public/test/image5.png

709 KB
Loading

src/app/(non-header)/layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Layout({ children }: { children: React.ReactNode }) {
2+
return <main className='min-h-screen'>{children}</main>;
3+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
'use client';
2+
3+
import Image from 'next/image';
4+
import React, { useState } from 'react';
5+
6+
interface ActivityImageProps {
7+
mainImage: string;
8+
subImages: string[];
9+
}
10+
11+
export default function ImageGrid({
12+
mainImage,
13+
subImages,
14+
}: ActivityImageProps) {
15+
const images = [mainImage, ...subImages];
16+
const [currentIndex, setCurrentIndex] = useState(0); //캐러셀 구현용 state
17+
18+
// 첫번째 이미지면 마지막 이미지로 아니면 -1
19+
const prevSlide = () => {
20+
setCurrentIndex((prev) => (prev === 0 ? images.length - 1 : prev - 1));
21+
};
22+
23+
// 현재 마지막 이미지면 첫 이미지로 아니면 +1
24+
const nextSlide = () => {
25+
setCurrentIndex((prev) => (prev === images.length - 1 ? 0 : prev + 1));
26+
};
27+
28+
return (
29+
<>
30+
{/* 모바일 */}
31+
<div className='relative block aspect-square h-[300px] w-full overflow-hidden rounded-lg md:hidden'>
32+
<Image
33+
src={images[currentIndex]}
34+
alt={`${currentIndex + 1}`}
35+
fill
36+
className='object-cover hover:animate-pulse'
37+
/>
38+
39+
<button
40+
onClick={prevSlide}
41+
className='absolute top-1/2 left-2 -translate-y-1/2 rounded-full bg-black/50 px-6 py-10 text-white'
42+
>
43+
44+
</button>
45+
<button
46+
onClick={nextSlide}
47+
className='absolute top-1/2 right-2 -translate-y-1/2 rounded-full bg-black/50 px-6 py-10 text-white'
48+
>
49+
50+
</button>
51+
52+
<div className='absolute bottom-2 left-1/2 flex -translate-x-1/2 gap-1'>
53+
{images.map((_, i) => (
54+
<div
55+
key={i}
56+
className={`h-10 w-10 rounded-full ${
57+
i === currentIndex ? 'bg-white' : 'bg-white/40'
58+
}`}
59+
/>
60+
))}
61+
</div>
62+
</div>
63+
{/* PC 태블릿 */}
64+
<div className='hidden h-[500px] grid-cols-4 grid-rows-4 gap-6 md:grid'>
65+
<div className='relative col-span-2 row-span-4 hover:animate-pulse'>
66+
<Image
67+
src={mainImage}
68+
alt='메인이미지'
69+
fill
70+
className='rounded-lg object-cover'
71+
/>
72+
</div>
73+
74+
{subImages.slice(0, 4).map((image, index) => (
75+
<div
76+
key={index}
77+
className='relative col-span-1 row-span-2 h-full hover:animate-pulse'
78+
>
79+
<Image
80+
src={image}
81+
alt={`서브이미지 ${index + 1}`}
82+
fill
83+
className='rounded-lg object-cover'
84+
/>
85+
</div>
86+
))}
87+
</div>
88+
</>
89+
);
90+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React from 'react';
2+
import IconDropdown from '@assets/svg/dropdown';
3+
4+
interface TitleProps {
5+
title: string;
6+
category: string;
7+
rating: number;
8+
reviewCount: number;
9+
address: string;
10+
isDropDown?: boolean;
11+
}
12+
13+
export default function Title({
14+
title,
15+
category,
16+
rating,
17+
reviewCount,
18+
address,
19+
isDropDown,
20+
}: TitleProps) {
21+
return (
22+
<div className='mb-6 flex items-start justify-between'>
23+
<div className='flex flex-col gap-8'>
24+
<p>{category}</p>
25+
<h1 className='mb-2 text-2xl font-bold text-black md:text-3xl'>
26+
{title}
27+
</h1>
28+
<div className='flex items-center gap-4 text-sm text-gray-600'>
29+
<div className='flex items-center gap-1'>
30+
<span className='text-yellow-500'></span>
31+
<span className='font-medium'>
32+
{rating.toFixed(1)} ({reviewCount}명)
33+
</span>
34+
</div>
35+
<span>{address}</span>
36+
</div>
37+
</div>
38+
39+
{isDropDown && (
40+
<div className='mt-30 flex items-center gap-2'>
41+
<IconDropdown />
42+
</div>
43+
)}
44+
</div>
45+
);
46+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
export const mockActivity = {
2+
id: 5088,
3+
userId: 2145,
4+
title: '함께 배우면 즐거운 스트릿댄스',
5+
description: '둠칫 둠칫 두둠칫',
6+
category: '투어',
7+
price: 10000,
8+
address: '서울특별시 강남구 테헤란로 427',
9+
bannerImageUrl: '/test/image1.png',
10+
rating: 0,
11+
reviewCount: 0,
12+
createdAt: '2025-07-16T16:49:19.971Z',
13+
updatedAt: '2025-07-16T16:49:19.971Z',
14+
subImages: [
15+
{
16+
id: 10643,
17+
imageUrl: '/test/image2.png',
18+
},
19+
{
20+
id: 10644,
21+
imageUrl: '/test/image3.png',
22+
},
23+
{
24+
id: 10645,
25+
imageUrl: '/test/image4.png',
26+
},
27+
{
28+
id: 10646,
29+
imageUrl: '/test/image5.png',
30+
},
31+
],
32+
schedules: [
33+
{
34+
id: 21515,
35+
date: '2025-12-01',
36+
startTime: '12:00',
37+
endTime: '13:00',
38+
},
39+
{
40+
id: 21516,
41+
date: '2025-12-05',
42+
startTime: '12:00',
43+
endTime: '13:00',
44+
},
45+
{
46+
id: 21517,
47+
date: '2025-12-05',
48+
startTime: '13:00',
49+
endTime: '14:00',
50+
},
51+
{
52+
id: 21518,
53+
date: '2025-12-05',
54+
startTime: '14:00',
55+
endTime: '15:00',
56+
},
57+
],
58+
};

0 commit comments

Comments
 (0)