mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-28 20:40:39 +00:00
Small cleanup of WinampButton
Missing hook dependency, and use default destructuring instead of defaultProps
This commit is contained in:
parent
73c3e3a63e
commit
bedc983d2a
1 changed files with 6 additions and 11 deletions
|
|
@ -31,13 +31,12 @@ type Props = DetailedHTMLPropsAndMore;
|
|||
* > and the time it is depressed; for a finger in a multitouch environment, while
|
||||
* > the finger is touching the display surface).
|
||||
*/
|
||||
export default function WinampButton(props: Props): JSX.Element {
|
||||
export default function WinampButton({
|
||||
requireClicksOriginateLocally = true,
|
||||
onPointerDown: originalOnPointerDown,
|
||||
...htmlProps
|
||||
}: Props): JSX.Element {
|
||||
const [active, setActive] = useState(false);
|
||||
const {
|
||||
requireClicksOriginateLocally,
|
||||
onPointerDown: originalOnPointerDown,
|
||||
...htmlProps
|
||||
} = props;
|
||||
|
||||
const onPointerDown = useCallback(
|
||||
(e) => {
|
||||
|
|
@ -66,7 +65,7 @@ export default function WinampButton(props: Props): JSX.Element {
|
|||
}
|
||||
document.addEventListener("pointerup", onRelease);
|
||||
},
|
||||
[originalOnPointerDown]
|
||||
[originalOnPointerDown, requireClicksOriginateLocally]
|
||||
);
|
||||
|
||||
// We watch for events onPointerEnter only when requireClicksOriginateLocally === false
|
||||
|
|
@ -97,7 +96,3 @@ export default function WinampButton(props: Props): JSX.Element {
|
|||
/>
|
||||
);
|
||||
}
|
||||
|
||||
WinampButton.defaultProps = {
|
||||
requireClicksOriginateLocally: true,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue