2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2025-02-21 21:15:05 +03:00
|
|
|
import { type Styling } from '../props';
|
2024-05-27 20:42:34 +03:00
|
|
|
|
2025-02-21 21:15:05 +03:00
|
|
|
interface DividerProps extends Styling {
|
2024-09-12 16:42:02 +03:00
|
|
|
/** Indicates whether the divider is vertical. */
|
2023-12-28 14:04:44 +03:00
|
|
|
vertical?: boolean;
|
2024-09-12 16:42:02 +03:00
|
|
|
|
|
|
|
/** Margins to apply to the divider `classNames`. */
|
2023-12-28 14:04:44 +03:00
|
|
|
margins?: string;
|
2023-07-20 17:11:03 +03:00
|
|
|
}
|
|
|
|
|
2024-09-12 16:42:02 +03:00
|
|
|
/**
|
2024-10-30 21:35:55 +03:00
|
|
|
* Horizontal or vertical divider with customizable margins and styling.
|
2024-09-12 16:42:02 +03:00
|
|
|
*/
|
2025-02-07 10:54:47 +03:00
|
|
|
export function Divider({ vertical, margins = 'mx-2', className, ...restProps }: DividerProps) {
|
2023-07-18 14:55:40 +03:00
|
|
|
return (
|
2023-12-28 14:04:44 +03:00
|
|
|
<div
|
2024-05-27 20:42:34 +03:00
|
|
|
className={clsx(
|
2025-03-10 16:02:53 +03:00
|
|
|
margins, //
|
2024-05-27 20:42:34 +03:00
|
|
|
className,
|
|
|
|
{
|
|
|
|
'border-x': vertical,
|
|
|
|
'border-y': !vertical
|
|
|
|
}
|
|
|
|
)}
|
|
|
|
{...restProps}
|
2023-12-28 14:04:44 +03:00
|
|
|
/>
|
|
|
|
);
|
2023-07-18 14:55:40 +03:00
|
|
|
}
|