Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeriaMaltseva committed Oct 9, 2024
1 parent 20bb37d commit 30b67d1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions assets/js/src/core/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ export const Select = forwardRef<RefSelectProps, SelectProps>(({ customIcon, cus
const { styles } = useStyles()

const withCustomIcon = !isEmptyValue(customIcon)
const isStatusWarning = status === 'warning'
const isStatusError = status === 'error'

const selectContainerClassNames = cn(styles.selectContainer, {
[styles.selectContainerWarning]: status === 'warning',
[styles.selectContainerError]: status === 'error'
[styles.selectContainerWarning]: isStatusWarning,
[styles.selectContainerError]: isStatusError
})
const selectClassNames = cn(styles.select, {
[styles.selectWithCustomIcon]: withCustomIcon
})
const customIconClassNames = cn(styles.customIcon, 'custom-select-icon', {
[styles.customIconActive]: isActive || isFocus,
[styles.customIconWarning]: (isActive || isFocus) && status === 'warning',
[styles.customIconError]: (isActive || isFocus) && status === 'error'
[styles.customIconWarning]: (isActive || isFocus) && isStatusWarning,
[styles.customIconError]: (isActive || isFocus) && isStatusError
})

const handleClick = (): void => { setIsActive(!isActive) }
Expand Down

0 comments on commit 30b67d1

Please sign in to comment.