rooks icon indicating copy to clipboard operation
rooks copied to clipboard

feat: useClickAndHold hook

Open jefersonvinicius opened this issue 2 years ago • 8 comments

I created a simple new hook that give the ability of click and hold.

jefersonvinicius avatar Oct 06 '21 17:10 jefersonvinicius

Codecov Report

Merging #602 (13dcf7d) into main (260e606) will increase coverage by 4.25%. The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #602      +/-   ##
==========================================
+ Coverage   72.94%   77.20%   +4.25%     
==========================================
  Files          66       68       +2     
  Lines        1327     1408      +81     
  Branches      268      282      +14     
==========================================
+ Hits          968     1087     +119     
+ Misses        358      320      -38     
  Partials        1        1              
Impacted Files Coverage Δ
src/hooks/useClickAndHold.ts 87.50% <87.50%> (ø)
src/hooks/useTimeout.ts 100.00% <0.00%> (ø)
src/hooks/usePrevious.ts 100.00% <0.00%> (ø)
src/hooks/useWarningOnMountInDevelopment.ts 100.00% <0.00%> (ø)
src/hooks/useInterval.ts 90.00% <0.00%> (+0.71%) :arrow_up:
src/hooks/useSessionstorage.ts 81.63% <0.00%> (+0.78%) :arrow_up:
src/hooks/useVisibilitySensor.ts 5.88% <0.00%> (+0.88%) :arrow_up:
src/hooks/useUpdateEffect.ts 92.85% <0.00%> (+1.19%) :arrow_up:
src/hooks/useDebounce.ts 100.00% <0.00%> (+6.66%) :arrow_up:
src/hooks/warning.ts 100.00% <0.00%> (+53.84%) :arrow_up:
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 260e606...13dcf7d. Read the comment docs.

codecov[bot] avatar Oct 09 '21 09:10 codecov[bot]

@jefersonvinicius Awesome hook! Could you explain more about what this hook can do here for context as I review it?

imbhargav5 avatar Oct 10 '21 04:10 imbhargav5

Hey @imbhargav5. The hook returns handlers (e.g onClick, onMouseDown, etc...) that you can attach to some HTML element, so, when element is clicked the action is triggered or if the user hold the element, the action is triggered with a interval until user release the element.

I would like add some codesandbox, but I haven't sure if the pull request should be merged first to be able install rooks lib in codesandbox with this hook available.

jefersonvinicius avatar Oct 13 '21 03:10 jefersonvinicius

I would like add some codesandbox, but I haven't sure if the pull request should be merged first to be able install rooks lib in codesandbox with this hook available.

Hi @jefersonvinicius, I guess you could copy this hook's source code to codesandbox and create an example first. Later after this hook is published we will help update the codesandbox!

qiweiii avatar Oct 13 '21 15:10 qiweiii

Hi @jefersonvinicius, I guess you could copy this hook's source code to codesandbox and create an example first. Later after this hook is published we will help update the codesandbox!

I'll do it. Thanks for the suggestion. I'm making some improvements as well!

jefersonvinicius avatar Oct 14 '21 01:10 jefersonvinicius

Hey @imbhargav5 and @qiweiii. I added a codesandbox example in useClickAndHold.md file! Let me know if now is right for the review! :D

jefersonvinicius avatar Oct 21 '21 16:10 jefersonvinicius

Hi @jefersonvinicius . Very sorry for being slow to respond. Totally my fault. Will get to this in the weekend!

imbhargav5 avatar Oct 29 '21 12:10 imbhargav5

Hey, it's everything alright :D

jefersonvinicius avatar Oct 30 '21 13:10 jefersonvinicius

It's cool! and how about using the pointer events instead of mouse or touch events? Most browsers support it.

hooriza avatar Jan 05 '23 02:01 hooriza

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Mar 20 '23 07:03 stale[bot]