mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-04 13:19:48 +03:00
Merge pull request #4340 from urbit/james/hark/usehovering
interface: consistent hover events
This commit is contained in:
commit
4a90989064
@ -363,11 +363,19 @@ export function useShowNickname(contact: Contact | null, hide?: boolean): boolea
|
|||||||
return !!(contact && contact.nickname && !hideNicknames);
|
return !!(contact && contact.nickname && !hideNicknames);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useHovering() {
|
interface useHoveringInterface {
|
||||||
|
hovering: boolean;
|
||||||
|
bind: {
|
||||||
|
onMouseOver: () => void,
|
||||||
|
onMouseLeave: () => void
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useHovering = (): useHoveringInterface => {
|
||||||
const [hovering, setHovering] = useState(false);
|
const [hovering, setHovering] = useState(false);
|
||||||
const bind = {
|
const bind = {
|
||||||
onMouseEnter: () => setHovering(true),
|
onMouseOver: () => setHovering(true),
|
||||||
onMouseLeave: () => setHovering(false)
|
onMouseLeave: () => setHovering(false)
|
||||||
};
|
};
|
||||||
return { hovering, bind };
|
return { hovering, bind };
|
||||||
}
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user