-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathDivider.tsx
More file actions
34 lines (31 loc) · 816 Bytes
/
Divider.tsx
File metadata and controls
34 lines (31 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import clsx from 'clsx'
import { EnumSize } from '@/style/variants'
interface PropsDivider extends React.HTMLAttributes<HTMLSpanElement> {
size?: typeof EnumSize.sm | typeof EnumSize.md | typeof EnumSize.lg
orientation?: 'horizontal' | 'vertical'
}
export const SIZE = new Map([
[EnumSize.sm, ''],
[EnumSize.md, '-2'],
[EnumSize.lg, '-4'],
])
export function Divider({
size = EnumSize.sm,
orientation = 'horizontal',
className,
}: PropsDivider): JSX.Element {
return (
<span
className={clsx(
[
'block border-divider',
orientation === 'horizontal' &&
`w-full border-b${SIZE.get(size) ?? ''}`,
orientation === 'vertical' &&
`h-full border-r${SIZE.get(size) ?? ''}`,
],
className,
)}
></span>
)
}