Skip to content

Commit d6248ee

Browse files
committed
[#47] ♻️ Add layout prop to Label component for row and col
1 parent cfe74ae commit d6248ee

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/common/label/Label.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,30 @@ export interface LabelProps
66
extends React.LabelHTMLAttributes<HTMLLabelElement> {
77
required?: boolean
88
labelText?: string
9+
layout?: 'col' | 'row'
910
}
1011

1112
export const Label = ({
1213
required = false,
1314
labelText,
15+
layout = 'col',
1416
htmlFor,
1517
children,
1618
className = '',
1719
}: LabelProps): JSX.Element => {
18-
const labelClass = clsx('flex flex-col text-body3 font-medium', className)
20+
const labelClass = clsx(
21+
'flex text-body3 font-medium',
22+
layout === 'col' ? 'flex-col' : 'flex-row',
23+
className
24+
)
25+
const labelTextClass = clsx(
26+
'flex items-center',
27+
layout === 'col' ? 'mb-4' : ''
28+
)
1929

2030
return (
2131
<label htmlFor={htmlFor} className={labelClass}>
22-
<div className='mb-4 flex items-center'>
32+
<div className={labelTextClass}>
2333
<span className='font-medium text-gray-600'>{labelText}</span>
2434
{required && <Highlight>*</Highlight>}
2535
</div>

0 commit comments

Comments
 (0)