Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(button): added ripple button, issue #300 #350

Merged
merged 6 commits into from
Oct 23, 2024

Conversation

AE-Hertz
Copy link
Contributor

@AE-Hertz AE-Hertz commented Oct 7, 2024

I am attaching a working video-

Screen.Recording.2024-10-07.112547.mp4

Please review it as its my first project working with storybook, i dont want to break your application by any means.

I have also made this in react here is the github repo - https://github.com/AE-Hertz/Mouse-hover-effect

Closes #300

@hari
Copy link
Contributor

hari commented Oct 7, 2024

Please fix the TS error, you will need to cast the element.

./animata/button/ripple-button.tsx:40:14
Type error: Property 'style' does not exist on type 'Element'.

  38 |       const y = event.clientY - rect.top - size / 2;
  39 |
> 40 |       ripple.style.left = `${x}px`;
     |              ^
  41 |       ripple.style.top = `${y}px`;
  42 |       ripple.classList.remove("ripple-enter");

@AE-Hertz
Copy link
Contributor Author

AE-Hertz commented Oct 8, 2024

I fixed the casting issue, please check.

Copy link

github-actions bot commented Oct 8, 2024

🚀 Preview deployed to: https://f7f39c8b.animata.pages.dev

Copy link
Contributor

@hari hari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AE-Hertz Please use tailwindcss.

@AE-Hertz
Copy link
Contributor Author

AE-Hertz commented Oct 8, 2024

@hari i am facing some issues and i am unable to figure out the reason -
the working component need to have this much inline-css (working properly) -
Screenshot 2024-10-08 231959
.
.
Here is the tailwind extend (not working properly) -
Screenshot 2024-10-08 231931

Screenshot 2024-10-08 231950

issue facing (after removing keyframes and animation from inline-css) -

Screen.Recording.2024-10-08.232955.mp4

If you can guide me on this , that would be great. Thank you

@AE-Hertz
Copy link
Contributor Author

AE-Hertz commented Oct 9, 2024

@hari attaching a screenshot below, this much inlinecss is must to make this effect work, please let me know what can i do.
Screenshot 2024-10-08 231959

@hari
Copy link
Contributor

hari commented Oct 10, 2024

@AE-Hertz could you push the lastest changes so I can run it locally?

@AE-Hertz
Copy link
Contributor Author

@hari yes i did, please check

Copy link

🚀 Preview deployed to: https://8e9bf933.animata.pages.dev

@hari
Copy link
Contributor

hari commented Oct 15, 2024

@AE-Hertz There is a bug when moving the mouse quickly. The ripple gets stuck.

Screen.Recording.2024-10-15.at.3.40.59.PM.mov

@AE-Hertz
Copy link
Contributor Author

@hari i tried to resolve and after researching i found its actually the issue with react onMouseLeave() , read many article like this - https://stackoverflow.com/questions/29981236/how-do-you-hover-in-reactjs-onmouseleave-not-registered-during-fast-hover-ove its an old issue but i did not able to find any solution.

If their is something with your knowledge please share with me , i will implement it.

@AE-Hertz
Copy link
Contributor Author

AE-Hertz commented Oct 17, 2024

@hari please check i think this method to handle mouse event by checking the state is more consistent.

Screen.Recording.2024-10-17.125536.mp4

If everything is fine, Please merge my PRs

Copy link

🚀 Preview deployed to: https://02756ac4.animata.pages.dev

@hari
Copy link
Contributor

hari commented Oct 17, 2024

@AE-Hertz instead of state you can use ref to track the hovered state.

@AE-Hertz
Copy link
Contributor Author

@AE-Hertz instead of state you can use ref to track the hovered state.

yeah , actually. should i change it then?

@hari
Copy link
Contributor

hari commented Oct 17, 2024

@AE-Hertz sure, why not?

@AE-Hertz
Copy link
Contributor Author

@hari hey i implemented it with useRef but its not as consistent as this version(useState), thats why not pushing that code(useRef) .

see clip.

Screen.Recording.2024-10-17.212747.mp4

@AE-Hertz
Copy link
Contributor Author

@hari well, i used both useRef and useState for better consistency, sending PR .

Copy link

🚀 Preview deployed to: https://20a1cd8e.animata.pages.dev

@sudhashrestha sudhashrestha self-requested a review October 22, 2024 04:06
Copy link
Contributor

@sudhashrestha sudhashrestha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @AE-Hertz

@sudhashrestha sudhashrestha merged commit 816539d into codse:main Oct 23, 2024
2 checks passed
@sudhashrestha sudhashrestha added the hacktoberfest This issue is a part of the Hacktoberfest event label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest This issue is a part of the Hacktoberfest event
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Button with hover animation
3 participants