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: close Wallet dropdown when clicking outside the component container #925

Merged
merged 5 commits into from
Aug 5, 2024

Conversation

cpcramer
Copy link
Contributor

@cpcramer cpcramer commented Jul 29, 2024

What changed? Why?
Add Wallet container ref and click event listener. Close the wallet dropdown when the user clicks outside of the wallet + wallet dropdown container if the dropdown is active!

Functionality recording:
https://www.loom.com/share/e51e2e6b1838499b86dc257c1d543f76

Notes to reviewers

How has it been tested?

@github-actions github-actions bot added documentation Improvements or additions to documentation pkg: wallet labels Jul 29, 2024
@cpcramer cpcramer changed the title wip 🚧 Close Wallet component when clicking outside component + dropdown Jul 29, 2024
@cpcramer cpcramer force-pushed the paul/click-to-close-dropdown branch from 2d78fe0 to bfd8921 Compare August 2, 2024 19:14
Copy link

vercel bot commented Aug 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 3, 2024 8:38pm

@cpcramer cpcramer changed the title 🚧 Close Wallet component when clicking outside component + dropdown Close Wallet component when clicking outside component + dropdown Aug 2, 2024
@cpcramer cpcramer changed the title Close Wallet component when clicking outside component + dropdown feat: Close Wallet component when clicking outside component container Aug 2, 2024
@cpcramer cpcramer changed the title feat: Close Wallet component when clicking outside component container feat: Close Wallet dropdown when clicking outside component container Aug 2, 2024
@cpcramer cpcramer changed the title feat: Close Wallet dropdown when clicking outside component container feat: Close Wallet dropdown when clicking outside the component container Aug 2, 2024
@cpcramer cpcramer changed the title feat: Close Wallet dropdown when clicking outside the component container feat: close Wallet dropdown when clicking outside the component container Aug 3, 2024
expect(mockSetIsOpen).toHaveBeenCalledWith(false);
});

it('should not close the wallet when clicking inside', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Niiice

});

it('should remove event listener on unmount', () => {
const removeEventListenerSpy = vi.spyOn(document, 'removeEventListener');
Copy link
Contributor

Choose a reason for hiding this comment

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

neat!!!

@Zizzamia Zizzamia merged commit b89f300 into main Aug 5, 2024
14 checks passed
@Zizzamia Zizzamia deleted the paul/click-to-close-dropdown branch August 5, 2024 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation pkg: wallet
Development

Successfully merging this pull request may close these issues.

2 participants