From 30b67d11ad880b44e6da5d1ea2dcddb09d596648 Mon Sep 17 00:00:00 2001 From: Valeriia Maltseva Date: Wed, 9 Oct 2024 17:38:04 +0200 Subject: [PATCH] refactoring --- assets/js/src/core/components/select/select.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/src/core/components/select/select.tsx b/assets/js/src/core/components/select/select.tsx index 270baf5a0..f8168311a 100644 --- a/assets/js/src/core/components/select/select.tsx +++ b/assets/js/src/core/components/select/select.tsx @@ -35,18 +35,20 @@ export const Select = forwardRef(({ 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) }