Skip to content

Commit 067fcea

Browse files
Merge pull request #542 from Tech4Aditya/feat/empty-state-ui
feat: improve activity feed UX with reusable empty state component
2 parents 101c7bd + 508078a commit 067fcea

2 files changed

Lines changed: 33 additions & 3 deletions

File tree

src/components/ActivityFeed.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect, useState } from "react";
2-
2+
import EmptyState from "./EmptyState";
33
interface EventType {
44
id: string;
55
type: string;
@@ -56,9 +56,14 @@ export default function ActivityFeed({ username }: { username: string }) {
5656
</h2>
5757

5858
{loading ? (
59-
<p className="text-center">Loading...</p>
59+
<div className="text-center py-6 text-gray-500">
60+
Fetching recent activity...
61+
</div>
6062
) : events.length === 0 ? (
61-
<p className="text-center">No activity found</p>
63+
<EmptyState
64+
title="No activity found"
65+
description="This user has no recent public GitHub activity."
66+
/>
6267
) : (
6368
events.slice(0, 10).map((event) => (
6469
<div

src/components/EmptyState.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
interface EmptyStateProps {
2+
title: string;
3+
description?: string;
4+
}
5+
6+
export default function EmptyState({
7+
title,
8+
description,
9+
}: EmptyStateProps) {
10+
return (
11+
<div className="flex flex-col items-center justify-center py-10 text-center">
12+
<div className="text-5xl mb-3">📭</div>
13+
14+
<h2 className="text-lg font-semibold text-gray-700 dark:text-gray-200">
15+
{title}
16+
</h2>
17+
18+
{description && (
19+
<p className="mt-2 text-sm text-gray-500 dark:text-gray-400 max-w-md">
20+
{description}
21+
</p>
22+
)}
23+
</div>
24+
);
25+
}

0 commit comments

Comments
 (0)