Portal/rsconcept/frontend/src/components/ui/Divider.tsx

33 lines
707 B
TypeScript
Raw Normal View History

2024-06-07 20:17:03 +03:00
import clsx from 'clsx';
import { CProps } from '@/components/props';
export interface DividerProps extends CProps.Styling {
/** Indicates whether the divider is vertical. */
2024-06-07 20:17:03 +03:00
vertical?: boolean;
/** Margins to apply to the divider `classNames`. */
2024-06-07 20:17:03 +03:00
margins?: string;
}
/**
2024-10-30 21:35:43 +03:00
* Horizontal or vertical divider with customizable margins and styling.
*/
2024-06-07 20:17:03 +03:00
function Divider({ vertical, margins = 'mx-2', className, ...restProps }: DividerProps) {
return (
<div
className={clsx(
margins, //prettier: split-lines
className,
{
'border-x': vertical,
'border-y': !vertical
}
)}
{...restProps}
/>
);
}
export default Divider;