Skip to content

Commit

Permalink
ButtonToggle: Fix VR scale animation (#3810)
Browse files Browse the repository at this point in the history
  • Loading branch information
diyorbek authored Oct 18, 2024
1 parent 34792de commit 123a661
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions packages/gestalt/src/ButtonToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,30 +308,26 @@ const ButtonToggleWithForwardRef = forwardRef<HTMLButtonElement, Props>(function
);
}

const childrenDivClasses = classnames(
sharedTypeClasses,
touchableStyles.tapTransition,
sizeStyles,
styles.childrenDiv,
{
[styles.compact]: text.length === 0,
[styles.disabled]: disabled && (color !== 'red' || selected),
[styles.disabledRed]: disabled && color === 'red' && !selected,
[styles.disabledTransparent]: disabled && color === 'transparent' && !selected,
[styles.enabled]: !disabled,
[borderStyles.noBorder]: color === 'red' && !selected,
[styles.selected]: !disabled && selected,
[styles.selectedDisabled]: disabled && selected,
[styles.thumbnailDark]: graphicSrc && isDarkMode !== selected,
[styles.thumbnailDisabled]: graphicSrc && disabled,
[styles.thumbnailLg]: size === 'lg' && graphicSrc,
[styles.thumbnailMd]: size === 'md' && graphicSrc,
[styles.thumbnailSm]: size === 'sm' && graphicSrc,
[styles[color]]: !disabled && !selected,
[styles.interactiveBorder]:
!disabled && !selected && !isFocused && color === 'transparent' && isInVRExperiment,
},
);
const childrenDivClasses = classnames(sharedTypeClasses, sizeStyles, styles.childrenDiv, {
[buttonToggleAnimation.classes]: isInVRExperiment,
[touchableStyles.tapTransition]: !isInVRExperiment,
[styles.compact]: text.length === 0,
[styles.disabled]: disabled && (color !== 'red' || selected),
[styles.disabledRed]: disabled && color === 'red' && !selected,
[styles.disabledTransparent]: disabled && color === 'transparent' && !selected,
[styles.enabled]: !disabled,
[borderStyles.noBorder]: color === 'red' && !selected,
[styles.selected]: !disabled && selected,
[styles.selectedDisabled]: disabled && selected,
[styles.thumbnailDark]: graphicSrc && isDarkMode !== selected,
[styles.thumbnailDisabled]: graphicSrc && disabled,
[styles.thumbnailLg]: size === 'lg' && graphicSrc,
[styles.thumbnailMd]: size === 'md' && graphicSrc,
[styles.thumbnailSm]: size === 'sm' && graphicSrc,
[styles[color]]: !disabled && !selected,
[styles.interactiveBorder]:
!disabled && !selected && !isFocused && color === 'transparent' && isInVRExperiment,
});

const textColor =
(disabled && 'disabled') ||
Expand Down

0 comments on commit 123a661

Please sign in to comment.