Skip to content

Commit 37faa02

Browse files
committed
[#102] ♻️ simplify classname by declaring vars
1 parent 2525455 commit 37faa02

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/components/shared/select/Select.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ export const Select = ({
3434
setSelectedLabel(label)
3535
}
3636

37+
const triggerStyle = clsx('w-210', {
38+
'pointer-events-none cursor-not-allowed': disabled,
39+
})
40+
3741
return (
3842
<Dropdown>
39-
<Dropdown.Trigger
40-
className={clsx('w-210', {
41-
'pointer-events-none cursor-not-allowed': disabled,
42-
})}
43-
aria-disabled={disabled}
44-
>
43+
<Dropdown.Trigger className={triggerStyle} aria-disabled={disabled}>
4544
<DropdownTriggerBox
4645
selectedLabel={selectedLabel || placeholder}
4746
selected={!!selectedLabel}
@@ -72,15 +71,14 @@ const DropdownTriggerBox = ({
7271
selected: boolean
7372
}) => {
7473
const { isOpen } = useDropdownContext()
74+
const triggerBoxClass = clsx(
75+
'h-48 justify-between p-12 text-body1 font-medium text-gray-500 focus:border-primary-normal',
76+
{ 'text-gray-800': selected },
77+
{ 'bg-gray-200 text-gray-400': disabled }
78+
)
79+
7580
return (
76-
<Box
77-
className={clsx(
78-
'h-48 justify-between p-12 text-body1 font-medium text-gray-500 focus:border-primary-normal',
79-
{ 'text-gray-800': selected },
80-
{ 'bg-gray-200 text-gray-400': disabled }
81-
)}
82-
rounded={8}
83-
>
81+
<Box className={triggerBoxClass} rounded={8}>
8482
{selectedLabel}
8583
{isOpen ? <IcCaretUp /> : <IcCaretDown />}
8684
</Box>

0 commit comments

Comments
 (0)