Skip to content

Commit f949a6f

Browse files
committed
feat(community): RepoCard UI 개선
1 parent 41c663e commit f949a6f

File tree

5 files changed

+59
-36
lines changed

5 files changed

+59
-36
lines changed

front/src/app/community/page.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import RepositoryList from '@/components/community/RepoList';
55
export default function HomePage() {
66
return (
77
<main className="max-w-3xl mx-auto p-6">
8-
<div className="mb-8">
9-
<h1 className="mb-2 text-3xl font-bold">커뮤니티</h1>
10-
<p className="text-muted-foreground">다른 사용자의 분석 결과를 둘러보세요.</p>
11-
</div>
128
<RepositoryList />
139
</main>
1410
);

front/src/components/community/RepoCard.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import type { RepositoryItem } from '@/types/community';
44
import { useRouter } from 'next/navigation'
55
import { formatRelativeTimeKST } from '@/lib/utils/formatDate'
6+
import { Github, ExternalLink } from "lucide-react"
67

78
export default function RepositoryCard({ item }: { item: RepositoryItem }) {
89
const router = useRouter();
@@ -35,12 +36,19 @@ export default function RepositoryCard({ item }: { item: RepositoryItem }) {
3536
</div>
3637

3738
{/* 레포지토리 링크 */}
38-
<a
39-
href="#"
40-
className="text-blue-600 font-semibold text-sm hover:underline"
41-
>
42-
{item.userName}/{item.repositoryName}
43-
</a>
39+
<div className="flex items-center gap-2">
40+
<Github className="h-4 w-4 text-muted-foreground" />
41+
<a
42+
href={item.htmlUrl}
43+
target="_blank"
44+
rel="noopener noreferrer"
45+
className="font-semibold text-primary hover:underline flex items-center gap-1"
46+
onClick={(e) => e.stopPropagation()} // 부모 클릭 이벤트 방지
47+
>
48+
{item.repositoryName}
49+
<ExternalLink className="h-3 w-3" />
50+
</a>
51+
</div>
4452

4553
{/* 요약 */}
4654
<p className="mt-2 text-gray-700 text-sm leading-relaxed">

front/src/components/community/RepoList.tsx

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,35 @@ export default function RepositoryList() {
1818

1919
return (
2020
<section className="flex flex-col gap-6 mt-6">
21-
{/* ✅ 정렬 버튼 */}
22-
<div className="flex justify-end gap-2">
23-
<Button
24-
variant={sortType === 'latest' ? 'default' : 'outline'}
25-
size="sm"
26-
onClick={() => setSortType('latest')}
27-
>
28-
최신순
29-
</Button>
30-
<Button
31-
variant={sortType === 'score' ? 'default' : 'outline'}
32-
size="sm"
33-
onClick={() => setSortType('score')}
34-
>
35-
점수순
36-
</Button>
21+
{/* 헤더 + 정렬 버튼 한 줄 정렬 */}
22+
<div className="flex items-center justify-between">
23+
<div>
24+
<h1 className="text-3xl font-bold">커뮤니티</h1>
25+
<p className="text-muted-foreground text-sm">
26+
다른 사용자의 분석 결과를 둘러보세요.
27+
</p>
28+
</div>
29+
30+
{/* 정렬 버튼 그룹 */}
31+
<div className="flex gap-2">
32+
<Button
33+
variant={sortType === 'latest' ? 'default' : 'outline'}
34+
size="sm"
35+
onClick={() => setSortType('latest')}
36+
>
37+
최신순
38+
</Button>
39+
<Button
40+
variant={sortType === 'score' ? 'default' : 'outline'}
41+
size="sm"
42+
onClick={() => setSortType('score')}
43+
>
44+
점수순
45+
</Button>
46+
</div>
3747
</div>
3848

49+
3950
{repositories.length === 0 ? (
4051
<p className="text-center text-muted-foreground">아직 공개된 분석이 없습니다.</p>
4152
) : (

front/src/components/history/HistoryContent.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,39 @@ export default function HistoryContent({ memberId, name }: HistoryContentProps)
2525

2626
return (
2727
<div className="max-w-3xl mx-auto p-6">
28-
<div className="mb-8">
29-
<h1 className="mb-2 text-3xl font-bold">분석 히스토리</h1>
30-
<p className="text-muted-foreground">시간에 따른 리포지토리 개선 사항을 추적하세요</p>
31-
</div>
28+
<div className="mb-6">
29+
{/* 제목 */}
30+
<h1 className="text-3xl font-bold">분석 히스토리</h1>
3231

33-
{/* 통계 카드 컴포넌트 */}
34-
<HistoryStats repositories={repositories} />
32+
{/* 설명 + 정렬 버튼 한 줄 정렬 */}
33+
<div className="flex items-center justify-between">
34+
<p className="text-muted-foreground text-sm">
35+
시간에 따른 리포지토리 개선 사항을 추적하세요
36+
</p>
3537

36-
{/* 정렬 버튼 */}
37-
<div className="flex justify-end gap-2 mb-4">
38+
{/* 정렬 버튼 그룹 */}
39+
<div className="flex gap-2">
3840
<Button
3941
variant={sortType === "latest" ? "default" : "outline"}
4042
size="sm"
4143
onClick={() => setSortType("latest")}
4244
>
43-
최신순
45+
최신순
4446
</Button>
4547
<Button
4648
variant={sortType === "score" ? "default" : "outline"}
4749
size="sm"
4850
onClick={() => setSortType("score")}
4951
>
50-
점수순
52+
점수순
5153
</Button>
54+
</div>
55+
</div>
5256
</div>
5357

58+
{/* 통계 카드 컴포넌트 */}
59+
<HistoryStats repositories={repositories} />
60+
5461
<div className="w-full max-w-3xl space-y-4">
5562
{repositories.length === 0 ? (
5663
// ✅ 분석 결과 없음 안내 카드

front/src/types/community.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface RepositoryItem {
1212
totalScore: number
1313
createDate: string // LocalDateTime → string
1414
viewingStatus: boolean
15+
htmlUrl: string
1516
}
1617

1718

0 commit comments

Comments
 (0)