-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure click events are triggered on button edges (#349)
- Loading branch information
1 parent
5213855
commit 39fa4cb
Showing
18 changed files
with
551 additions
and
455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rainbow-me/rainbowkit': patch | ||
--- | ||
|
||
Fix bug where click events were ignored on the edges of links/buttons due to scale transforms during hover/active states |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 22 additions & 18 deletions
40
packages/rainbowkit/src/components/CloseButton/CloseButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
import React from 'react'; | ||
import { increaseHitAreaForHoverTransform } from '../../css/increaseHitAreaForHoverTransform.css'; | ||
import { isMobile } from '../../utils/isMobile'; | ||
import { Box } from '../Box/Box'; | ||
import { CloseIcon } from '../Icons/Close'; | ||
|
||
export const CloseButton = ({ | ||
onClose, | ||
style, | ||
}: { | ||
onClose: () => void; | ||
style?: React.CSSProperties; | ||
}) => { | ||
export const CloseButton = ({ onClose }: { onClose: () => void }) => { | ||
const mobile = isMobile(); | ||
return ( | ||
<Box | ||
alignItems="center" | ||
as="button" | ||
background="closeButtonBackground" | ||
borderColor="actionButtonBorder" | ||
borderRadius="full" | ||
borderStyle="solid" | ||
borderWidth={mobile ? '0' : '1'} | ||
color="closeButton" | ||
className={increaseHitAreaForHoverTransform.growLg} | ||
display="flex" | ||
height={mobile ? '30' : '28'} | ||
justifyContent="center" | ||
onClick={onClose} | ||
style={{ willChange: 'transform', ...(style ?? {}) }} | ||
transform={{ active: 'shrinkSm', hover: 'growLg' }} | ||
transition="default" | ||
type="button" | ||
width={mobile ? '30' : '28'} | ||
> | ||
<CloseIcon /> | ||
<Box | ||
alignItems="center" | ||
background="closeButtonBackground" | ||
borderColor="actionButtonBorder" | ||
borderRadius="full" | ||
borderStyle="solid" | ||
borderWidth={mobile ? '0' : '1'} | ||
color="closeButton" | ||
display="flex" | ||
height="full" | ||
justifyContent="center" | ||
style={{ willChange: 'transform' }} | ||
transform={{ active: 'shrinkSm', hover: 'growLg' }} | ||
transition="default" | ||
width="full" | ||
> | ||
<CloseIcon /> | ||
</Box> | ||
</Box> | ||
); | ||
}; |
Oops, something went wrong.
39fa4cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rainbowkit-example – ./
rainbowkit-example-git-main-rainbowdotme.vercel.app
rainbowkit-example.vercel.app
rainbowkit-example-rainbowdotme.vercel.app
39fa4cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rainbowkit-site – ./
rainbowkit-site-git-main-rainbowdotme.vercel.app
rainbowkit-site-rainbowdotme.vercel.app
rainbowkit.vercel.app
rainbowkit.com
www.rainbowkit.com