Skip to content

Commit 18583e1

Browse files
committed
feat(ui): add Divider component
1 parent c557f97 commit 18583e1

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

src/components/ui/Divider.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import React from 'react';
2-
interface Props { label?: string; className?: string; orientation?: 'horizontal' | 'vertical'; }
3-
const Divider: React.FC<Props> = ({ label, className = '', orientation = 'horizontal' }) => {
4-
if (orientation === 'vertical') return <div className={'w-px bg-gray-200 dark:bg-gray-700 self-stretch ' + className} />;
5-
if (label) return (
6-
<div className={'flex items-center gap-4 ' + className}>
7-
<div className='flex-1 h-px bg-gray-200 dark:bg-gray-700' />
8-
<span className='text-sm text-gray-500 font-medium'>{label}</span>
9-
<div className='flex-1 h-px bg-gray-200 dark:bg-gray-700' />
10-
</div>
11-
);
12-
return <hr className={'border-gray-200 dark:border-gray-700 ' + className} />;
13-
};
2+
interface Props { text?: string; className?: string; }
3+
const Divider: React.FC<Props> = ({ text, className = '' }) => (
4+
<div className={'flex items-center gap-4 ' + className}>
5+
<div className='flex-1 h-px bg-gray-200 dark:bg-gray-700' />
6+
{text && <span className='text-sm text-gray-400 font-medium'>{text}</span>}
7+
<div className='flex-1 h-px bg-gray-200 dark:bg-gray-700' />
8+
</div>
9+
);
1410
export default Divider;

0 commit comments

Comments
 (0)