react-awesome-button icon indicating copy to clipboard operation
react-awesome-button copied to clipboard

Adding keyEvent simulation to buttons.

Open IhsenBen opened this issue 2 years ago • 0 comments

I was wondering if you could expose pressed: boolean props to allow simulating pressing buttons with other events, something like this

const AwesomeButton = ({
  // ... existing props
  pressed = false,
}: ButtonType) => {
  // ... existing code

  useEffect(() => {
    if (pressed) {
      pressIn({} as React.MouseEvent);
    } else {
      pressOut({} as React.MouseEvent);
    }
  }, [pressed]);

  // ... existing code
}

I know that the active props already exits, but still, it doesn't fire the pressIn and pressOut functions, if you are ok with this, , I can work on the pull request.

IhsenBen avatar Dec 02 '23 15:12 IhsenBen