-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
198 additions
and
74 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
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
12 changes: 12 additions & 0 deletions
12
packages/walletkit/src/components/CustomQRCode/QRCodePlaceHolder/index.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Box } from '../../base/Box'; | ||
import { container, corner } from './styles.css'; | ||
|
||
export function QRCodePlaceHolder() { | ||
return ( | ||
<Box className={container}> | ||
<Box as="span" className={corner} /> | ||
<Box as="span" className={corner} /> | ||
<Box as="span" className={corner} /> | ||
</Box> | ||
); | ||
} |
82 changes: 82 additions & 0 deletions
82
packages/walletkit/src/components/CustomQRCode/QRCodePlaceHolder/styles.css.ts
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,82 @@ | ||
import { style, keyframes } from '@vanilla-extract/css'; | ||
import { cssVar } from '../../..'; | ||
|
||
const flicker = keyframes({ | ||
'0%': { | ||
backgroundPosition: '100% 0', | ||
}, | ||
'100%': { | ||
backgroundPosition: '-100% 0', | ||
}, | ||
}); | ||
|
||
export const container = style({ | ||
width: '100%', | ||
height: '100%', | ||
opacity: 0.1, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
position: 'absolute', | ||
pointerEvents: 'none', | ||
'::before': { | ||
zIndex: 3, | ||
content: '""', | ||
position: 'absolute', | ||
inset: 0, | ||
backgroundPosition: 'initial', | ||
backgroundRepeat: 'repeat', | ||
backgroundAttachment: 'initial', | ||
backgroundOrigin: 'initial', | ||
backgroundClip: 'initial', | ||
backgroundColor: 'initial', | ||
backgroundSize: '1.888% 1.888%', | ||
backgroundImage: `radial-gradient(${cssVar('qrCodeDot')} 41%,transparent 41%)`, | ||
}, | ||
'::after': { | ||
zIndex: 5, | ||
content: '""', | ||
position: 'absolute', | ||
inset: 0, | ||
transform: 'scale(2) rotate(45deg)', | ||
backgroundImage: | ||
'linear-gradient(90deg, rgba(255, 255, 255, 0) 50%, rgb(255, 255, 255), rgba(255, 255, 255, 0))', | ||
backgroundSize: '200% 100%', | ||
animation: `1000ms linear 0s infinite normal both running ${flicker}`, | ||
}, | ||
}); | ||
|
||
export const corner = style({ | ||
zIndex: 4, | ||
position: 'absolute', | ||
|
||
background: cssVar('qrCodeDot'), | ||
borderRadius: 8, | ||
width: '13.2%', | ||
height: '13.2%', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
outline: `3px solid ${cssVar('modalBackground')}`, | ||
'::before': { | ||
content: '""', | ||
width: '42.86%', | ||
height: '42.86%', | ||
borderRadius: 4, | ||
border: `4px solid ${cssVar('modalBackground')}`, | ||
}, | ||
selectors: { | ||
'&:nth-child(1)': { | ||
left: 0, | ||
top: 0, | ||
}, | ||
'&:nth-child(2)': { | ||
right: 0, | ||
top: 0, | ||
}, | ||
'&:nth-child(3)': { | ||
left: 0, | ||
bottom: 0, | ||
}, | ||
}, | ||
}); |
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,33 @@ | ||
import { ReactElement } from 'react'; | ||
import { Box, BoxProps } from '../base/Box'; | ||
import { QRCode } from './QRCode'; | ||
import { QRCodePlaceHolder } from './QRCodePlaceHolder'; | ||
import { qrCodeContainer, qrCodeLogo, qrCodeWrapper } from './styles.css'; | ||
import { cx } from '../../utils/css'; | ||
|
||
export interface CustomQRCodeProps extends BoxProps { | ||
logo?: ReactElement; | ||
logoSize?: number; | ||
value?: string; | ||
} | ||
|
||
export function CustomQRCode(props: CustomQRCodeProps) { | ||
const { className, logo, logoSize = 52, value, ...restProps } = props; | ||
|
||
return ( | ||
<Box className={cx('wk-qrcode', qrCodeContainer, className)} {...restProps}> | ||
<Box className={qrCodeWrapper}> | ||
{value ? <QRCode uri={value} /> : <QRCodePlaceHolder />} | ||
<Box | ||
className={cx('wk-qrcode-logo', qrCodeLogo)} | ||
style={{ | ||
width: logoSize, | ||
height: logoSize, | ||
}} | ||
> | ||
{logo} | ||
</Box> | ||
</Box> | ||
</Box> | ||
); | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/walletkit/src/components/CustomQRCode/styles.css.ts
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,34 @@ | ||
import { globalStyle, style } from '@vanilla-extract/css'; | ||
import { cssVar } from '../../utils/css'; | ||
|
||
export const qrCodeContainer = style({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
width: 240, | ||
height: 240, | ||
overflow: 'hidden', | ||
fontSize: 0, | ||
border: '1px solid', | ||
borderColor: cssVar('qrCodeBorder'), | ||
borderRadius: cssVar('qrCode', 'radii'), | ||
}); | ||
|
||
export const qrCodeWrapper = style({ | ||
width: 212, | ||
height: 212, | ||
position: 'relative', | ||
}); | ||
|
||
export const qrCodeLogo = style({ | ||
position: 'absolute', | ||
left: '50%', | ||
top: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
display: 'inline-flex', | ||
}); | ||
|
||
globalStyle(`${qrCodeLogo} > svg`, { | ||
width: '100%', | ||
height: '100%', | ||
}); |
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
16 changes: 1 addition & 15 deletions
16
packages/walletkit/src/pages/ConnectWithQRCode/styles.css.ts
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
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