Closed boredcity closed 1 year ago
This update introduces a new custom React hook, useHover
, that tracks the hover state of a target element. It also includes an Example
component in the playground app to demonstrate the usage of this hook. The hook and the example component provide options for memoization and different types of targets.
File | Summary |
---|---|
.../hooks/useHover.stories.tsx |
Adds a new Example component demonstrating the useHover hook with various configurations. |
packages/react-hooks/... |
Introduces the useHover hook that tracks the hover state of a target element and triggers optional callbacks on hover events. |
🐇💻
In the land of code, where the brackets lie, A new hook was born, under the digital sky. Hover here, hover there, it keeps track so sly, With each mouse move, it catches your eye.
Memoize or not, it's your choice to apply, Target as ref or function, give both a try. Celebrate we must, for the code does comply, To the rules of hooks, oh how time does fly! 🎉🥳
@boredcity wow! this pr is amaizing 🔥 I've just requested small changes
I've fixed whatever I agreed with our robotic overlords on :)
Please, @ulises-jeremias, @rpmolina review the changes and see if you agree with the concerns raised by the bot 🙏
What's this PR do?
This PR adds
useHover
hook (issue #94) and a story for ease of review. Since other stories rely on imports from the published packages I suggest reviewing PR as is and changing the import path after that.@ulises-jeremias @rpmolina
Summary by CodeRabbit
New Feature:
useHover
custom hook in the@nanlabs/react-hooks
library. This hook allows tracking the hover state of a target element and provides optional callback functions for hover events.Example
component in the playground app to demonstrate the usage of theuseHover
hook. The component changes its appearance based on hover state and allows toggling of memoization and target type.Refactor:
react-hooks
package to include the newuseHover
module.