// src/components/ui/divider.tsx import React from 'react'; type Direction = 'horizontal' | 'vertical'; type DividerType = 'horizontal' | 'vertical' | 'text'; interface DividerProps { direction?: Direction; type?: DividerType; text?: React.ReactNode; color?: string; margin?: string; className?: string; } const Divider: React.FC = ({ direction = 'horizontal', type = 'horizontal', text, color = 'border-muted-foreground/50', margin = 'my-4', className = '', }) => { const baseClasses = 'flex items-center'; const directionClass = direction === 'horizontal' ? 'flex-row' : 'flex-col'; const colorClass = color.startsWith('border-') ? color : `border-${color}`; const marginClass = margin || ''; const textClass = 'px-4 text-sm text-muted-foreground'; // Default vertical style if (direction === 'vertical') { return (
{type === 'text' && (
{text}
)}
); } // Horizontal with text if (type === 'text') { return (
{text}
); } // Default horizontal return (
); }; export default Divider;