feat(03-02): add EmptyState component and wire into Dashboard and Categories pages
- Create shared EmptyState component with icon, heading, subtext, and optional CTA button - DashboardPage: show EmptyState when no budgets exist with Create CTA; replace plain Card fallback with EmptyState for no-current-budget case - CategoriesPage: add loading state to prevent empty-state flash on initial load; show EmptyState when no categories exist
This commit is contained in:
21
frontend/src/components/EmptyState.tsx
Normal file
21
frontend/src/components/EmptyState.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
interface EmptyStateProps {
|
||||
icon: React.ElementType
|
||||
heading: string
|
||||
subtext: string
|
||||
action?: { label: string; onClick: () => void }
|
||||
}
|
||||
|
||||
export function EmptyState({ icon: Icon, heading, subtext, action }: EmptyStateProps) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center py-16 text-center">
|
||||
<Icon className="size-12 text-muted-foreground mb-4" />
|
||||
<h2 className="font-semibold text-lg mb-1">{heading}</h2>
|
||||
<p className="text-sm text-muted-foreground mb-4">{subtext}</p>
|
||||
{action && (
|
||||
<Button onClick={action.onClick}>{action.label}</Button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user