Skip to content

Commit a2096df

Browse files
authored
Merge pull request #51 from geulDa/feat/#49/main-board
✨Feat: main페이지 board판
2 parents 193cbc6 + 0ae1cda commit a2096df

File tree

10 files changed

+136
-15
lines changed

10 files changed

+136
-15
lines changed

public/assets/background_.svg

Lines changed: 9 additions & 0 deletions
Loading

public/assets/bannerMain.svg

Lines changed: 1 addition & 1 deletion
Loading

src/pages/main/Board.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Header } from '@/shared/components';
2+
3+
import Boardgame from '@/pages/main/components/board/Boardgame';
4+
import router from 'next/router';
5+
6+
const Board = () => {
7+
return (
8+
<div className='relative w-full h-[100vh] bg-[#46d1cd] overflow-auto'>
9+
<Header title='지도' onClick={() => router.back()} />
10+
11+
<main className='relative pt-[11.8rem]'>
12+
<Boardgame />
13+
</main>
14+
</div>
15+
);
16+
};
17+
18+
export default Board;

src/pages/main/components/.gitkeep

Whitespace-only changes.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use client';
2+
import Image from 'next/image';
3+
import { boardData } from '@/shared/constants/main/boardData';
4+
5+
const Boardgame = () => {
6+
return (
7+
<div className='relative w-full h-full bg-[#46d1cd] overflow-hidden'>
8+
<Image
9+
src='/assets/background_.svg'
10+
alt='board background'
11+
width={402}
12+
height={755}
13+
className='w-full h-full object-cover'
14+
priority
15+
/>
16+
17+
<div
18+
className='
19+
absolute top-0 left-0
20+
w-full h-full
21+
grid grid-cols-4 grid-rows-8 gap-0
22+
px-[2rem] pb-[1.7rem]
23+
'
24+
>
25+
{boardData.map((row, r) =>
26+
row.map((cell, c) => {
27+
const key = `cell-${r}-${c}`;
28+
29+
if (!cell.active) {
30+
return <div key={key} className='bg-transparent' />;
31+
}
32+
33+
return (
34+
<div key={key} onClick={() => console.log(cell.label)}></div>
35+
);
36+
}),
37+
)}
38+
</div>
39+
</div>
40+
);
41+
};
42+
43+
export default Boardgame;

src/pages/main/components/stampBoard/Stamp.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@ const Stamp = ({ index, acquired, className }: StampProps) => {
1212
return (
1313
<div
1414
className={cn(
15-
'flex items-center justify-center w-[3rem] h-[3rem]',
15+
'flex items-center justify-center w-[2.8rem] h-[2.8rem]',
1616
className,
1717
)}
1818
aria-label={`${index + 1}번째 스탬프 획득`}
1919
>
20-
<Icon name='Stamp' size={30} color='pink-400' aria-hidden />
20+
<Icon name='Stamp' size={28} color='pink-400' aria-hidden />
2121
</div>
2222
);
2323
}
2424

2525
return (
2626
<div
27-
className={cn('rounded-full bg-pink-100 w-[3rem] h-[3rem]', className)}
27+
className={cn(
28+
'rounded-full bg-pink-100 w-[2.8rem] h-[2.8rem]',
29+
className,
30+
)}
2831
aria-label={`${index + 1}번째 스탬프 미획득`}
2932
/>
3033
);

src/pages/main/index.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@ import { cn } from '@/shared/lib';
22
import StampBoard from './components/stampBoard/StampBoard';
33
import { ControlBar } from '@/shared/components';
44
import Image from 'next/image';
5+
import router from 'next/router';
6+
import { BottomNav } from '@/shared/components/tab/BottomNav';
57

68
export default function MainPage() {
79
return (
8-
<div className={cn('px-[2.4rem] bg-white flex flex-col gap-[1rem]')}>
10+
<div
11+
className={cn(
12+
'px-[2.4rem] bg-white flex flex-col gap-[1rem] h-full pt-[1.3rem] pb-[12rem]',
13+
)}
14+
>
915
<ControlBar
1016
isLoggedIn={false}
1117
onLogin={() => {}}
1218
userName='글다'
13-
className='fixed top-[0.6rem] left-0 right-0 z-50 px-[2rem]'
19+
className='fixed top-[1rem] left-0 right-0 z-50 px-[2rem]'
1420
/>
1521

16-
<main className='w-full pt-[6.2rem] flex flex-col gap-4 overflow-auto'>
22+
<main className='w-full pt-[6.3rem] flex flex-col gap-4 overflow-auto'>
1723
<section>
1824
<Image
1925
src='/assets/bannerMain.svg'
@@ -26,7 +32,7 @@ export default function MainPage() {
2632

2733
<section
2834
onClick={() => {
29-
/* TODO: 페이지 이동 */
35+
router.push('/main/Board');
3036
}}
3137
>
3238
<Image
@@ -38,8 +44,9 @@ export default function MainPage() {
3844
/>
3945
</section>
4046

41-
<StampBoard count={3} total={8} />
47+
<StampBoard count={3} total={10} />
4248
</main>
49+
<BottomNav />
4350
</div>
4451
);
4552
}

src/shared/components/tab/BottomNav.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ export const BottomNav = () => {
2323

2424
return (
2525
<nav
26-
className="
27-
fixed bottom-[2rem] left-[2.4rem]
26+
className='
27+
fixed bottom-[5.3rem] left-[2.4rem]
2828
w-[calc(100%-4.8rem)]
2929
flex justify-between items-center
3030
py-[1rem]
3131
rounded-[37.07px]
3232
bg-mint-50 border border-mint-300
33-
"
34-
aria-label="Bottom navigation"
33+
'
34+
aria-label='Bottom navigation'
3535
>
3636
{NAV_ITEMS.map((item) => {
3737
const isActive =
@@ -42,8 +42,8 @@ export const BottomNav = () => {
4242
<Link
4343
key={item.id}
4444
href={item.href}
45-
aria-current={isActive ? 'page' : undefined}
46-
className="flex-1 flex justify-center"
45+
aria-current={isActive ? 'page' : undefined}
46+
className='flex-1 flex justify-center'
4747
>
4848
<TabItem label={item.label} icon={item.icon} isActive={isActive} />
4949
</Link>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const boardData = [
2+
[{ active: false }, { active: false }, { active: false }, { active: false }],
3+
[
4+
{ active: true, label: '김수환관' },
5+
{ active: true, label: '부천 아트벙커' },
6+
{ active: true, label: '한국 만화박물관' },
7+
{ active: false },
8+
],
9+
[
10+
{ active: false },
11+
{ active: false },
12+
{ active: false },
13+
{ active: true, label: '상동 호수 공원' },
14+
],
15+
[
16+
{ active: false },
17+
{ active: true, label: '부천역' },
18+
{ active: true, label: '다솔관' },
19+
{ active: true, label: '부천 자유 시장' },
20+
],
21+
[
22+
{ active: false },
23+
{ active: true, label: '중앙도서관' },
24+
{ active: false },
25+
{ active: false },
26+
],
27+
[
28+
{ active: false },
29+
{ active: false },
30+
{ active: true, label: '역곡공원' },
31+
{ active: false },
32+
],
33+
[
34+
{ active: false },
35+
{ active: false },
36+
{ active: false },
37+
{ active: true, label: '부천 식물원' },
38+
],
39+
[{ active: false }, { active: false }, { active: false }, { active: false }],
40+
];
41+
export { boardData };

0 commit comments

Comments
 (0)