import { forwardRef } from 'react';

import * as SeparatorPrimitive from '@radix-ui/react-separator';

import { cn } from '#utils';

export const Separator = forwardRef<
  React.ElementRef<typeof SeparatorPrimitive.Root>,
  React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
>(function Separator({ className, decorative = true, orientation = 'horizontal', ...props }, ref) {
  return (
    <SeparatorPrimitive.Root
      className={cn(
        'bg-border shrink-0',
        orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
        className
      )}
      data-testid="separator"
      decorative={decorative}
      orientation={orientation}
      ref={ref}
      {...props}
    />
  );
});
