Skip to content

Commit c1b3601

Browse files
committed
feat: 홈 페이지에서 사용하는 컴포넌트 구현 및 섹션 분리하여 홈 페이지 구현
1 parent b42e1bc commit c1b3601

6 files changed

Lines changed: 134 additions & 4 deletions

File tree

app/(with-sidebar)/(home)/page.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1-
// export default function Home() {
2-
// return <div>home</div>;
3-
// }
1+
import BottomSection from '@/components/home/BottomSection';
2+
import Card from '@/components/home/Card';
3+
import GraphSection from '@/components/home/GraphSection';
4+
import HeaderSection from '@/components/home/HeaderSection';
5+
import ProfileSection from '@/components/home/ProfileSection';
46

57
const Page = () => {
6-
return <div>home</div>;
8+
return (
9+
<div className="bg-background flex min-h-screen flex-col gap-6 font-sans md:p-[137px]">
10+
{/* 1. Header */}
11+
<HeaderSection />
12+
13+
{/* 2-1. ProfileSection */}
14+
<ProfileSection className="grid grid-cols-1 gap-6 md:grid-cols-3" />
15+
16+
{/* 2-2. GraphSection */}
17+
<GraphSection></GraphSection>
18+
19+
{/* 2-3. BottomSection */}
20+
<BottomSection className="grid grid-cols-1 gap-6 md:grid-cols-2" />
21+
22+
{/* 3. ButtonSection */}
23+
{/* 버튼 두개 만드쇼 */}
24+
</div>
25+
);
726
};
827

928
export default Page;

components/home/BottomSection.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Card from './Card';
2+
3+
interface BottomSectionProps {
4+
className?: string;
5+
}
6+
7+
const BottomSection = ({ className }: BottomSectionProps) => {
8+
return (
9+
<div className={className}>
10+
<Card title="오늘 할 일">대충 할 일</Card>
11+
<Card title="다가오는 일정">대충 일정</Card>
12+
</div>
13+
);
14+
};
15+
16+
export default BottomSection;

components/home/Card.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ReactNode } from 'react';
2+
3+
// 흰 바탕의 카드
4+
5+
interface CardProps {
6+
children: ReactNode; // 카드 내부 내용들
7+
className?: string; // 추가 스타일링
8+
title?: string; // 좌측 상단 제목이 있는 경우
9+
}
10+
11+
const Card = ({ children, className = '', title }: CardProps) => {
12+
return (
13+
<div
14+
className={`border-border bg-surface rounded-[10px] p-6 shadow-sm ${className}`}
15+
>
16+
{title && (
17+
<h2 className="mb-4 text-lg font-bold text-gray-900">{title}</h2>
18+
)}
19+
{children}
20+
</div>
21+
);
22+
};
23+
24+
export default Card;

components/home/GraphSection.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Card from './Card';
2+
3+
interface GraphSectionProps {
4+
className?: string;
5+
}
6+
7+
const GraphSection = ({ className }: GraphSectionProps) => {
8+
return (
9+
<div className={className}>
10+
<Card title="학습 기록">대충 잔디그래프</Card>
11+
</div>
12+
);
13+
};
14+
15+
export default GraphSection;

components/home/HeaderSection.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
interface HeaderSectionProps {
2+
className?: string;
3+
}
4+
5+
const HeaderSection = ({ className }: HeaderSectionProps) => {
6+
return (
7+
<div className={className}>
8+
<h1 className="flex items-center gap-2 text-3xl font-bold text-gray-900">
9+
안녕하세요 <span className="text-3xl">🖐️</span>
10+
</h1>
11+
<p className="mt-1 text-gray-500">오늘도 성장하는 하루를 만들어보세요!</p>
12+
</div>
13+
);
14+
};
15+
16+
export default HeaderSection;

components/home/ProfileSection.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import Card from './Card';
2+
3+
interface ProfileSectionProps {
4+
className?: string;
5+
}
6+
7+
const ProfileSection = ({ className }: ProfileSectionProps) => {
8+
return (
9+
<div className={className}>
10+
<div className="md:col-span-2">
11+
<Card className="flex items-center gap-4">
12+
<div className="flex h-16 w-16 items-center justify-center overflow-hidden rounded-full border border-gray-100 bg-purple-100">
13+
<span className="text-3xl">😈</span>
14+
</div>
15+
16+
<div>
17+
<h3 className="text-xl font-bold text-gray-900">이건무</h3>
18+
<p className="text-sm text-gray-500">@mnmnnmm324</p>
19+
<div className="mt-1 flex gap-2 text-xs font-medium">
20+
<span className="text-purple-600">38193일 연속</span>
21+
<span className="text-gray-400">|</span>
22+
<span className="text-gray-600">12개 TIL</span>
23+
</div>
24+
</div>
25+
</Card>
26+
</div>
27+
28+
<div className="md:col-span-1">
29+
<Card className="flex h-full flex-col items-center justify-center text-center">
30+
<div className="mb-1 text-4xl font-bold text-purple-600">3/5</div>
31+
<div className="text-sm font-medium text-gray-500">
32+
오늘의 목표 달성률
33+
</div>
34+
</Card>
35+
</div>
36+
</div>
37+
);
38+
};
39+
40+
export default ProfileSection;

0 commit comments

Comments
 (0)