File tree Expand file tree Collapse file tree 1 file changed +39
-2
lines changed
src/components/common/divider Expand file tree Collapse file tree 1 file changed +39
-2
lines changed Original file line number Diff line number Diff line change 1- export const Divider = ( ) : JSX . Element => {
2- return < div className = 'h-14 w-1 bg-gray-200' />
1+ import { twMerge } from 'tailwind-merge'
2+
3+ interface DividerProps {
4+ isVertical ?: boolean
5+ thickness ?: Length
6+ length ?: Length
7+ color ?: string
8+ className ?: string
9+ }
10+
11+ type Length = '1' | '14' | 'full'
12+
13+ const heightMap : Record < Length , string > = {
14+ '1' : 'h-1' ,
15+ '14' : 'h-14' ,
16+ full : 'h-full' ,
17+ }
18+ const weightMap : Record < Length , string > = {
19+ '1' : 'w-1' ,
20+ '14' : 'w-14' ,
21+ full : 'w-full' ,
22+ }
23+
24+ export const Divider = ( {
25+ isVertical = true ,
26+ thickness = '1' ,
27+ length = 'full' ,
28+ color = 'bg-gray-200' ,
29+ className = '' ,
30+ } : DividerProps ) : JSX . Element => {
31+ const dividerClass = twMerge (
32+ 'min-h-0 min-w-0' ,
33+ color ,
34+ isVertical ? heightMap [ length ] : heightMap [ thickness ] ,
35+ isVertical ? weightMap [ thickness ] : weightMap [ length ] ,
36+ className
37+ )
38+
39+ return < div className = { dividerClass } />
340}
You can’t perform that action at this time.
0 commit comments