-
Notifications
You must be signed in to change notification settings - Fork 6
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
10 changed files
with
226 additions
and
10 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
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
44 changes: 44 additions & 0 deletions
44
packages/checkout/src/views/PaymentSelection/FiatOnRamp.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,44 @@ | ||
import { Box, Button, Card, Text, useMediaQuery } from '@0xsequence/design-system' | ||
import { getCardHeight } from '../../utils/sizing' | ||
|
||
interface FiatOnRampProps { | ||
disableButtons: boolean | ||
} | ||
|
||
export const FiatOnRamp = ({ | ||
disableButtons | ||
}: FiatOnRampProps) => { | ||
const isMobile = useMediaQuery('isMobile') | ||
const onClickPurchase = () => {} | ||
|
||
return ( | ||
<Card | ||
width="full" | ||
flexDirection={isMobile ? 'column' : 'row'} | ||
alignItems="center" | ||
justifyContent="space-between" | ||
gap={isMobile ? '2' : '0'} | ||
style={{ | ||
minHeight: getCardHeight(isMobile) | ||
}} | ||
> | ||
<Box justifyContent={isMobile ? 'center' : 'flex-start'}> | ||
<Text color="text100">Purchase Crypto</Text> | ||
</Box> | ||
<Box | ||
flexDirection="column" | ||
gap="2" | ||
alignItems={isMobile ? 'center' : 'flex-start'} | ||
style={{ ...(isMobile ? { width: '200px' } : {}) }} | ||
> | ||
<Button | ||
disabled={disableButtons} | ||
label="Purchase" | ||
onClick={onClickPurchase} | ||
variant="primary" | ||
shape="square" | ||
/> | ||
</Box> | ||
</Card> | ||
) | ||
} |
57 changes: 57 additions & 0 deletions
57
packages/checkout/src/views/PaymentSelection/TransferFunds.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,57 @@ | ||
import { Box,Button, Card, Text, useMediaQuery } from '@0xsequence/design-system' | ||
import { useAccount } from 'wagmi' | ||
|
||
import { getCardHeight } from '../../utils/sizing' | ||
import { useTransferFundsModal } from '../../hooks' | ||
|
||
interface TransferFundsProps { | ||
disableButtons: boolean | ||
} | ||
|
||
export const TransferFunds = ({ | ||
disableButtons | ||
}: TransferFundsProps) => { | ||
const isMobile = useMediaQuery('isMobile') | ||
const { openTransferFundsModal } = useTransferFundsModal() | ||
const { address: userAddress } = useAccount() | ||
|
||
const onClickTransfer = () => { | ||
if (!userAddress) { | ||
return | ||
} | ||
openTransferFundsModal({ | ||
walletAddress: userAddress | ||
}) | ||
} | ||
|
||
return ( | ||
<Card | ||
width="full" | ||
flexDirection={isMobile ? 'column' : 'row'} | ||
alignItems="center" | ||
justifyContent="space-between" | ||
gap={isMobile ? '2' : '0'} | ||
style={{ | ||
minHeight: getCardHeight(isMobile) | ||
}} | ||
> | ||
<Box justifyContent={isMobile ? 'center' : 'flex-start'}> | ||
<Text color="text100">Transfer Funds to Wallet</Text> | ||
</Box> | ||
<Box | ||
flexDirection="column" | ||
gap="2" | ||
alignItems={isMobile ? 'center' : 'flex-start'} | ||
style={{ ...(isMobile ? { width: '200px' } : {}) }} | ||
> | ||
<Button | ||
disabled={disableButtons} | ||
label="Transfer" | ||
onClick={onClickTransfer} | ||
variant="primary" | ||
shape="square" | ||
/> | ||
</Box> | ||
</Card> | ||
) | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/checkout/src/views/PaymentSelection/TransferToWallet/index.tsx
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
37 changes: 37 additions & 0 deletions
37
packages/checkout/src/views/TransferToWallet/CopyButton.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,37 @@ | ||
import { Button, CopyIcon, CheckmarkIcon } from '@0xsequence/design-system' | ||
import { useEffect, useState, ComponentProps } from 'react' | ||
import { CopyToClipboard } from 'react-copy-to-clipboard' | ||
|
||
type ButtonProps = ComponentProps<typeof Button> | ||
|
||
interface CopyButtonProps extends ButtonProps { | ||
text: string | ||
inline?: boolean | ||
} | ||
|
||
export const CopyButton = (props: CopyButtonProps) => { | ||
const { text, size = 'xs', inline = false, ...rest } = props | ||
const [isCopied, setCopy] = useState(false) | ||
|
||
useEffect(() => { | ||
if (isCopied) { | ||
setTimeout(() => { | ||
setCopy(false) | ||
}, 4000) | ||
} | ||
}, [isCopied]) | ||
|
||
const handleCopy = () => { | ||
setCopy(true) | ||
} | ||
|
||
return ( | ||
<CopyToClipboard text={text} onCopy={handleCopy}> | ||
{inline ? ( | ||
<Button size={size} variant="text" leftIcon={isCopied ? CheckmarkIcon : CopyIcon} /> | ||
) : ( | ||
<Button size={size} leftIcon={isCopied ? CheckmarkIcon : CopyIcon} label={isCopied ? "Copied" : "Copy"} {...rest} /> | ||
)} | ||
</CopyToClipboard> | ||
) | ||
} |
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,25 @@ | ||
import { Box, Skeleton } from '@0xsequence/design-system' | ||
import ReactQRCode from 'qrcode.react' | ||
|
||
import { CopyButton } from './CopyButton' | ||
|
||
interface QRCodeProps { | ||
value: string | undefined | ||
} | ||
|
||
export const QRCode = (props: QRCodeProps) => { | ||
const { value } = props | ||
|
||
return ( | ||
<Box alignItems="center" flexDirection="column" gap="4"> | ||
{value ? ( | ||
<Box background="white" padding="4" borderRadius="sm" style={{ width: 232, height: 232 }}> | ||
<ReactQRCode value={value} size={200} bgColor="white" fgColor="black" data-id="qr-code" /> | ||
</Box> | ||
) : ( | ||
<Skeleton style={{ width: 232, height: 232 }} /> | ||
)} | ||
<CopyButton text={value || ''} disabled={!value} /> | ||
</Box> | ||
) | ||
} |
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,19 +1,42 @@ | ||
import { Box } from '@0xsequence/design-system' | ||
import { Box, Text } from '@0xsequence/design-system' | ||
import { useAccount } from 'wagmi' | ||
|
||
import { HEADER_HEIGHT } from '../../constants' | ||
import { QRCode } from './QRCode' | ||
import { useTransferFundsModal } from '../../hooks' | ||
|
||
export const TransferToWallet = () => { | ||
const { address: userAddress } = useAccount() | ||
const { transferFundsSettings } = useTransferFundsModal() | ||
|
||
const address = transferFundsSettings?.walletAddress || userAddress || '' | ||
|
||
return ( | ||
<Box | ||
flexDirection="column" | ||
gap='2' | ||
alignItems="flex-start" | ||
alignItems="center" | ||
justifyContent="center" | ||
width="full" | ||
paddingX="4" | ||
paddingBottom="4" | ||
height="full" | ||
style={{ height: '600px', paddingTop: HEADER_HEIGHT }} | ||
style={{ paddingTop: HEADER_HEIGHT }} | ||
> | ||
transfer to wallet content | ||
<Box flexDirection="column" alignItems="center" paddingX="4" paddingBottom="4" minHeight="full"> | ||
<Box flexDirection="column" placeItems="center" width="full"> | ||
<Text as="p" variant="normal" color="text50" textAlign="center"> | ||
Share your wallet address to receive coins | ||
</Text> | ||
<Box marginY="4"> | ||
<QRCode value={address} data-id="receiveQR" /> | ||
</Box> | ||
|
||
<Text as="div" width="full" variant="normal" color="text50" textAlign="center" data-id="receiveAddress"> | ||
{address} | ||
</Text> | ||
</Box> | ||
</Box> | ||
</Box> | ||
) | ||
} |