Как отключить действие framer-motion onHover, когда кнопка отключена в Reactjs? - PullRequest
0 голосов
/ 03 августа 2020

Я хотел бы отключить действие framer-motion whileHover, когда моя кнопка имеет атрибут disabled, как лучше всего сделать это в React?

Вот мой текущий код для моей кнопки.

export default function Button(props) {
  const themeContext = useContext(ThemeContext); // used to get the context of our Styled-components theme.

  return (
    
    <ButtonSecondaryStyle className="rounded-md"   
      whileHover={{ scale: 1.05, backgroundColor:themeContext.secondaryColorActive }}
      whileTap={{ scale: 0.95 }}
      scaleTransition={{
        type: "spring",
        delay: 0,
        stiffness: 500,
        damping: 60,
        mass: 1,
      }}
      type={props.type}
      name={props.name}
      disabled={props.disabled}
      onClick={props.onClick}
    >
      {props.title}
    </ButtonSecondaryStyle>
  )
}
...