Skip to content

Commit 954ad96

Browse files
author
=
committed
Make activeClass cleaner
1 parent 0f51adc commit 954ad96

File tree

1 file changed

+6
-14
lines changed
  • react/components/AutocompleteInput/SearchInput

1 file changed

+6
-14
lines changed

react/components/AutocompleteInput/SearchInput/index.tsx

+6-14
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,17 @@ const SearchInput: React.FC<PropTypes.InferProps<typeof propTypes> &
7070
onBlur && onBlur(e)
7171
}
7272

73-
let activeClass = classNames({
73+
const regularSize = size !== 'small' && size !== 'large'
74+
const activeClass = classNames({
7475
'b--muted-3': focused,
7576
'b--muted-4': !focused,
7677
'br--top': !roundedBottom,
77-
'bg-disabled c-disabled': disabled,
78-
'bg-base c-on-base': !disabled,
78+
'bg-disabled': disabled,
79+
'bg-base': !disabled,
80+
[`h-${size}`]: !regularSize,
81+
'h-regular': regularSize,
7982
})
8083

81-
switch (size) {
82-
case 'small':
83-
activeClass += ` h-${size}`
84-
break
85-
case 'large':
86-
activeClass += ` h-${size}`
87-
break
88-
default:
89-
activeClass += ' h-regular'
90-
}
91-
9284
const buttonClasses = classNames(
9385
activeClass,
9486
'bg-base br2 br--right w3 bw1 ba pa0 bl-0',

0 commit comments

Comments
 (0)