-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
9677078
commit 36c9199
Showing
15 changed files
with
563 additions
and
136 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Avatar, Button, Text } from '@chakra-ui/react' | ||
|
||
type AssetSelectionProps = { | ||
onClick: () => void | ||
label: string | ||
} | ||
|
||
export const AssetSelection: React.FC<AssetSelectionProps> = ({ label, onClick }) => { | ||
return ( | ||
<Button flexDir='column' height='auto' py={4} gap={4} flex={1} onClick={onClick}> | ||
<Text color='text.subtle'>{label}</Text> | ||
<Avatar /> | ||
<Text>Bitcoin</Text> | ||
</Button> | ||
) | ||
} |
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,39 @@ | ||
import { Button, Card, CardBody, Flex, Heading, IconButton } from '@chakra-ui/react' | ||
import { useCallback, useMemo } from 'react' | ||
import { FaArrowRightArrowLeft } from 'react-icons/fa6' | ||
import { useNavigate } from 'react-router-dom' | ||
|
||
import { AssetSelection } from './AssetSelection' | ||
|
||
export const SelectPair = () => { | ||
const navigate = useNavigate() | ||
const switchIcon = useMemo(() => <FaArrowRightArrowLeft />, []) | ||
const handleSubmit = useCallback(() => { | ||
navigate('/input') | ||
}, [navigate]) | ||
|
||
const handleFromAssetClick = useCallback(() => { | ||
console.info('asset click') | ||
}, []) | ||
const handleToAssetClick = useCallback(() => { | ||
console.info('to asset click') | ||
}, []) | ||
|
||
return ( | ||
<Card width='full' maxWidth='450px'> | ||
<CardBody display='flex' flexDir='column' gap={8}> | ||
<Heading as='h4' fontSize='md' textAlign='center'> | ||
Choose which assets to trade | ||
</Heading> | ||
<Flex alignItems='center' gap={4} color='text.subtle' width='full'> | ||
<AssetSelection label='Deposit' onClick={handleFromAssetClick} /> | ||
<IconButton variant='ghost' icon={switchIcon} aria-label='Switch assets' /> | ||
<AssetSelection label='Recieve' onClick={handleToAssetClick} /> | ||
</Flex> | ||
<Button size='lg' colorScheme='blue' onClick={handleSubmit}> | ||
Continue | ||
</Button> | ||
</CardBody> | ||
</Card> | ||
) | ||
} |
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,166 @@ | ||
import { | ||
Avatar, | ||
Card, | ||
CardBody, | ||
CardFooter, | ||
CardHeader, | ||
Center, | ||
Divider, | ||
Flex, | ||
IconButton, | ||
Input, | ||
InputGroup, | ||
InputRightElement, | ||
Stack, | ||
Tag, | ||
Text, | ||
useSteps, | ||
} from '@chakra-ui/react' | ||
import { useCallback, useMemo } from 'react' | ||
import { FaArrowDown, FaArrowRightArrowLeft, FaCheck, FaRegCopy } from 'react-icons/fa6' | ||
import { useCopyToClipboard } from 'hooks/useCopyToClipboard' | ||
import { BTCImage, ETHImage } from 'lib/const' | ||
|
||
import type { StepProps } from './components/StatusStepper' | ||
import { StatusStepper } from './components/StatusStepper' | ||
|
||
const steps: StepProps[] = [ | ||
{ | ||
title: 'Awaiting Deposit', | ||
icon: FaArrowDown, | ||
}, | ||
{ | ||
title: 'Awaiting Exchange', | ||
icon: FaArrowRightArrowLeft, | ||
}, | ||
{ | ||
title: 'Trade Complete', | ||
icon: FaCheck, | ||
}, | ||
] | ||
|
||
export const Status = () => { | ||
const { activeStep } = useSteps({ | ||
index: 0, | ||
count: steps.length, | ||
}) | ||
const CopyIcon = useMemo(() => <FaRegCopy />, []) | ||
const CheckIcon = useMemo(() => <FaCheck />, []) | ||
const { copyToClipboard: copyToAddress, isCopied: isToAddressCopied } = useCopyToClipboard({ | ||
timeout: 3000, | ||
}) | ||
const { copyToClipboard: copyDepositAddress, isCopied: isDepositAddressCopied } = | ||
useCopyToClipboard({ timeout: 3000 }) | ||
|
||
const handleCopyToAddress = useCallback(() => { | ||
copyToAddress('1234') | ||
}, [copyToAddress]) | ||
|
||
const handleCopyDepositAddress = useCallback(() => { | ||
copyDepositAddress('1234') | ||
}, [copyDepositAddress]) | ||
|
||
return ( | ||
<Card width='full' maxW='465px'> | ||
<CardHeader | ||
bg='background.surface.raised.base' | ||
display='flex' | ||
justifyContent='center' | ||
gap={1} | ||
borderTopRadius='xl' | ||
fontSize='sm' | ||
py={2} | ||
> | ||
<Text color='text.subtle'>TX ID</Text> | ||
<Text>0x124567</Text> | ||
</CardHeader> | ||
<CardBody display='flex' flexDir='row-reverse' gap={6} px={4}> | ||
<Flex flexDir='column' gap={4}> | ||
<Center boxSize='150px' bg='background.surface.raised.base' borderRadius='xl' /> | ||
<Tag colorScheme='green' size='sm' justifyContent='center'> | ||
Time remaining 06:23 | ||
</Tag> | ||
</Flex> | ||
<Stack spacing={4} flex={1}> | ||
<Stack> | ||
<Text fontWeight='bold'>Send</Text> | ||
<Flex alignItems='center' gap={2}> | ||
<Avatar size='sm' src={BTCImage} /> | ||
<Text>0.002 BTC</Text> | ||
</Flex> | ||
</Stack> | ||
<Stack> | ||
<Text fontWeight='bold'>To</Text> | ||
<InputGroup> | ||
<Input isReadOnly value='bc1q8n6t65jpm6k0...x7gl' /> | ||
<InputRightElement> | ||
<IconButton | ||
borderRadius='lg' | ||
size='sm' | ||
variant='ghost' | ||
icon={isToAddressCopied ? CheckIcon : CopyIcon} | ||
aria-label='Copy address' | ||
onClick={handleCopyToAddress} | ||
/> | ||
</InputRightElement> | ||
</InputGroup> | ||
</Stack> | ||
<Divider borderColor='border.base' /> | ||
<Stack> | ||
<Text fontWeight='bold'>You will receive</Text> | ||
<Flex gap={2} alignItems='center'> | ||
<Avatar size='xs' src={ETHImage} /> | ||
<Text>0.000158162 ETH</Text> | ||
</Flex> | ||
</Stack> | ||
</Stack> | ||
</CardBody> | ||
<StatusStepper steps={steps} activeStep={activeStep} /> | ||
<CardFooter | ||
flexDir='column' | ||
gap={4} | ||
px={4} | ||
bg='background.surface.raised.base' | ||
borderBottomRadius='xl' | ||
> | ||
<Text fontWeight='bold'>Order Details</Text> | ||
<Stack> | ||
<Flex width='full' justifyContent='space-between'> | ||
<Flex alignItems='center' gap={2}> | ||
<Avatar size='xs' src={BTCImage} /> | ||
<Text>Deposit</Text> | ||
</Flex> | ||
<Text color='text.subtle'>0.002 BTC</Text> | ||
</Flex> | ||
<Flex alignItems='center' gap={2}> | ||
<Text>bc1q8n6t65jpm6k048ejvwgfa69xp5laqr2sexx7gl</Text> | ||
<IconButton | ||
size='sm' | ||
variant='ghost' | ||
icon={isDepositAddressCopied ? CheckIcon : CopyIcon} | ||
aria-label='Copy deposit address' | ||
onClick={handleCopyDepositAddress} | ||
/> | ||
</Flex> | ||
</Stack> | ||
<Stack> | ||
<Flex width='full' justifyContent='space-between'> | ||
<Flex alignItems='center' gap={2}> | ||
<Avatar size='xs' src={ETHImage} /> | ||
<Text>Receive</Text> | ||
</Flex> | ||
<Text color='text.subtle'>0.00158162 ETH</Text> | ||
</Flex> | ||
<Flex alignItems='center' gap={2}> | ||
<Text>0x1234484844949494949</Text> | ||
</Flex> | ||
</Stack> | ||
<Divider borderColor='border.base' /> | ||
<Flex alignItems='center' justifyContent='space-between'> | ||
<Text>Estimated Rate</Text> | ||
<Text>1 BTC = 12.90126 ETH</Text> | ||
</Flex> | ||
</CardFooter> | ||
</Card> | ||
) | ||
} |
Oops, something went wrong.