Skip to content

Commit

Permalink
Make activeClass cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jun 25, 2020
1 parent 0f51adc commit 954ad96
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions react/components/AutocompleteInput/SearchInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,17 @@ const SearchInput: React.FC<PropTypes.InferProps<typeof propTypes> &
onBlur && onBlur(e)
}

let activeClass = classNames({
const regularSize = size !== 'small' && size !== 'large'
const activeClass = classNames({
'b--muted-3': focused,
'b--muted-4': !focused,
'br--top': !roundedBottom,
'bg-disabled c-disabled': disabled,
'bg-base c-on-base': !disabled,
'bg-disabled': disabled,
'bg-base': !disabled,
[`h-${size}`]: !regularSize,
'h-regular': regularSize,
})

switch (size) {
case 'small':
activeClass += ` h-${size}`
break
case 'large':
activeClass += ` h-${size}`
break
default:
activeClass += ' h-regular'
}

const buttonClasses = classNames(
activeClass,
'bg-base br2 br--right w3 bw1 ba pa0 bl-0',
Expand Down

0 comments on commit 954ad96

Please sign in to comment.