Skip to content

Commit 7c3e9bb

Browse files
committed
feat(ui): add EmptyState component
1 parent 77c2e5f commit 7c3e9bb

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/components/ui/EmptyState.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import React from 'react';
2-
interface Props { icon?: React.ReactNode; title: string; description?: string; action?: React.ReactNode; className?: string; }
2+
import { motion } from 'framer-motion';
3+
interface Props { icon: React.ReactNode; title: string; description?: string; action?: { label: string; onClick: () => void }; className?: string; }
34
const EmptyState: React.FC<Props> = ({ icon, title, description, action, className = '' }) => (
4-
<div className={'flex flex-col items-center justify-center py-16 px-4 text-center ' + className}>
5-
{icon && <div className='w-20 h-20 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mb-6 text-3xl text-gray-400'>{icon}</div>}
6-
<h3 className='text-xl font-semibold text-gray-900 dark:text-white mb-2'>{title}</h3>
7-
{description && <p className='text-gray-500 max-w-md mb-6'>{description}</p>}
8-
{action}
9-
</div>
5+
<motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }}
6+
className={'text-center py-16 px-4 ' + className}>
7+
<div className='text-5xl mb-4 opacity-40'>{icon}</div>
8+
<h3 className='text-xl font-bold text-gray-900 dark:text-white mb-2'>{title}</h3>
9+
{description && <p className='text-gray-500 max-w-md mx-auto mb-6'>{description}</p>}
10+
{action && <button onClick={action.onClick} className='px-6 py-2.5 bg-blue-600 text-white rounded-xl font-medium hover:bg-blue-700'>{action.label}</button>}
11+
</motion.div>
1012
);
1113
export default EmptyState;

0 commit comments

Comments
 (0)