nanlabs / nancy.js

This repository contains different React components, hooks, apps and libraries that are used in different projects here at NaN Labs.
https://nanlabs.github.io/nancy.js
MIT License
23 stars 10 forks source link

Feat: Added useHover hook #98

Closed boredcity closed 1 year ago

boredcity commented 1 year ago

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:

Refactor:

coderabbitai[bot] commented 1 year ago

Walkthrough

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.

Changes

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! 🎉🥳

Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - Mention `@coderabbitai` in any *review comment* for bot assistance. - Note: Review comments are made on code diffs or files, not on the PR overview. ### Pause Incremental Reviews - Insert `@coderabbitai: ignore` in the PR description to halt the bot's ongoing reviews. Remove the line to resume. - Additionally, enter `@coderabbitai pause` to halt the bot's ongoing reviews as any issue or review comment. To resume reviews, enter `@coderabbitai resume` as any issue or review comment.
rpmolina commented 1 year ago

@boredcity wow! this pr is amaizing 🔥 I've just requested small changes

boredcity commented 1 year ago

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 🙏