|
1
|
import { clx } from "@/utils/clx" |
|
2
|
import * as React from "react" |
|
3
|
|
|
4
|
interface DividerProps |
|
5
|
extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> { |
|
6
|
orientation?: "horizontal" | "vertical" |
|
7
|
variant?: "dashed" | "solid" |
|
8
|
} |
|
9
|
|
|
10
|
export const Divider = ({ |
|
11
|
orientation = "horizontal", |
|
12
|
variant = "solid", |
|
13
|
className, |
|
14
|
...props |
|
15
|
}: DividerProps) => { |
|
16
|
return ( |
|
17
|
<div |
|
18
|
aria-orientation={orientation} |
|
19
|
role="separator" |
|
20
|
className={clx( |
|
21
|
"border-ui-border-base", |
|
22
|
{ |
|
23
|
"w-full border-t": |
|
24
|
orientation === "horizontal" && variant === "solid", |
|
25
|
"h-full border-l": orientation === "vertical" && variant === "solid", |
|
26
|
"bg-transparent": variant === "dashed", |
|
27
|
"h-px w-full bg-[linear-gradient(90deg,var(--border-strong)_1px,transparent_1px)] bg-[length:4px_1px]": |
|
28
|
variant === "dashed" && orientation === "horizontal", |
|
29
|
"h-full w-px bg-[linear-gradient(0deg,var(--border-strong)_1px,transparent_1px)] bg-[length:1px_4px]": |
|
30
|
variant === "dashed" && orientation === "vertical", |
|
31
|
}, |
|
32
|
className |
|
33
|
)} |
|
34
|
{...props} |
|
35
|
/> |
|
36
|
) |
|
37
|
} |