Skip to content

Commit efd5743

Browse files
committed
refactor: ReceiveEther.tsx to tailwind
migrate qr-code pngs
1 parent f3424a4 commit efd5743

File tree

4 files changed

+48
-93
lines changed

4 files changed

+48
-93
lines changed
-15 KB
Binary file not shown.
-17.9 KB
Binary file not shown.
9.09 KB
Loading
Lines changed: 48 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,60 @@
1-
import React from "react"
21
import { motion } from "framer-motion"
3-
import { Button } from "@chakra-ui/react"
4-
import { Box, Flex, Text, useColorModeValue } from "@chakra-ui/react"
52

6-
import { Image } from "@/components/Image"
3+
import EthGlyph from "@/components/icons/eth-glyph-solid.svg"
4+
import { TwImage } from "@/components/Image"
5+
import { Button } from "@/components/ui/buttons/Button"
6+
import { Flex } from "@/components/ui/flex"
77

88
import { FAKE_DEMO_ADDRESS } from "../../constants"
99
import { NotificationPopover } from "../../NotificationPopover"
1010

11-
import QRDark from "@/public/images/qr-code-ethereum-org-dark.png"
12-
import QRLight from "@/public/images/qr-code-ethereum-org-light.png"
11+
import QrImage from "@/public/images/qr-code-ethereum-org.png"
1312

14-
const MotionBox = motion(Box)
15-
16-
export const ReceiveEther = () => {
17-
const qrImage = useColorModeValue(QRLight, QRDark)
18-
19-
const SPACING = { base: 3, md: 5 }
20-
const QR_SIZE = { base: "80px", md: "120px" }
21-
return (
22-
<MotionBox
23-
initial={{ opacity: 0 }}
24-
animate={{ opacity: 1 }}
25-
exit={{ opacity: 0 }}
26-
transition={{ duration: 0.25 }}
27-
py={{ base: 6, md: 8 }}
28-
px={{ base: 4, md: 6 }}
29-
h="full"
30-
bg="background.highlight"
31-
fontSize={{ base: "sm", md: "md" }}
13+
export const ReceiveEther = () => (
14+
<motion.div
15+
initial={{ opacity: 0 }}
16+
animate={{ opacity: 1 }}
17+
exit={{ opacity: 0 }}
18+
transition={{ duration: 0.25 }}
19+
className="h-full bg-background-highlight px-4 py-6 text-sm md:px-6 md:py-8 md:text-md"
20+
>
21+
<p className="mb-3 text-xl font-bold md:mb-6 md:text-2xl">Receive assets</p>
22+
<p className="mb-3 md:mb-5">
23+
Show this QR code containing your account address to the sender
24+
</p>
25+
{/* QR Code */}
26+
<NotificationPopover
27+
title="Example walkthrough"
28+
content="Share QR containing your address (public identifier) from your own wallet when finished here"
29+
placement="top"
3230
>
33-
<Text
34-
fontSize={{ base: "xl", md: "2xl" }}
35-
fontWeight="bold"
36-
mb={{ base: 3, md: 6 }}
37-
>
38-
Receive assets
39-
</Text>
40-
<Text mb={SPACING}>
41-
Show this QR code containing your account address to the sender
42-
</Text>
43-
{/* QR Code */}
31+
<div className="relative mx-auto mb-3 w-fit bg-background p-3 md:mb-5">
32+
<TwImage
33+
alt=""
34+
src={QrImage}
35+
className="size-[6rem] rounded p-1 md:size-[7.5rem] dark:invert"
36+
/>
37+
<div className="absolute left-1/2 top-1/2 size-10 -translate-x-1/2 -translate-y-1/2 transform rounded-full bg-primary-action" />
38+
<EthGlyph className="absolute left-1/2 top-1/2 size-6 -translate-x-1/2 -translate-y-1/2 transform text-white" />
39+
</div>
40+
</NotificationPopover>
41+
<Flex className="relative mb-3 w-full items-center justify-between gap-2 rounded border px-3 py-2 md:mb-5">
42+
<div>
43+
<p className="m-0 text-xs text-body-medium">Your Ethereum address</p>
44+
<p className="m-0 text-sm">{FAKE_DEMO_ADDRESS}</p>
45+
</div>
4446
<NotificationPopover
4547
title="Example walkthrough"
46-
content="Share QR containing your address (public identifier) from your own wallet when finished here"
47-
placement="top"
48+
content="Share your address (public identifier) from your own wallet when finished here"
49+
placement="top-start"
4850
>
49-
<Box w="fit-content" mx="auto" mb={SPACING} p={3} bg="background.base">
50-
<Image
51-
alt=""
52-
src={qrImage}
53-
maxW={QR_SIZE}
54-
maxH={QR_SIZE}
55-
p={3}
56-
borderRadius="base"
57-
/>
58-
</Box>
51+
<Button className="h-fit rounded-lg bg-body-light px-2 py-1.5 text-xs font-bold text-body">
52+
Copy
53+
</Button>
5954
</NotificationPopover>
60-
<Flex
61-
borderRadius="base"
62-
border="1px"
63-
borderColor="body.light"
64-
px={3}
65-
py={2}
66-
gap={2}
67-
position="relative"
68-
w="100%"
69-
justify="space-between"
70-
alignItems="center"
71-
mb={SPACING}
72-
>
73-
<Box>
74-
<Text color="body.medium" m={0} fontSize="xs">
75-
Your Ethereum address
76-
</Text>
77-
<Text m={0} fontSize="sm">
78-
{FAKE_DEMO_ADDRESS}
79-
</Text>
80-
</Box>
81-
<NotificationPopover
82-
title="Example walkthrough"
83-
content="Share your address (public identifier) from your own wallet when finished here"
84-
placement="top-start"
85-
>
86-
<Button
87-
fontSize="xs"
88-
fontWeight="bold"
89-
color="body.base"
90-
bg="body.light"
91-
borderRadius="10px"
92-
h="fit-content"
93-
py={1.5}
94-
px={2}
95-
>
96-
Copy
97-
</Button>
98-
</NotificationPopover>
99-
</Flex>
100-
<Text m={0} fontSize="xs" lineHeight={1.7}>
101-
Use this address for receiving tokens and NFTs on the Ethereum network.
102-
</Text>
103-
</MotionBox>
104-
)
105-
}
55+
</Flex>
56+
<p className="m-0 text-xs">
57+
Use this address for receiving tokens and NFTs on the Ethereum network.
58+
</p>
59+
</motion.div>
60+
)

0 commit comments

Comments
 (0)