Skip to content

Commit dbd2f15

Browse files
feat(Simulator/screens/Success): migrate to Tailwind
1 parent 9a12c5d commit dbd2f15

File tree

1 file changed

+46
-48
lines changed
  • src/components/Simulator/screens/SendReceive

1 file changed

+46
-48
lines changed

src/components/Simulator/screens/SendReceive/Success.tsx

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
import React, { useEffect, useState } from "react"
1+
import { useEffect, useState } from "react"
22
import { AnimatePresence, motion } from "framer-motion"
33
import { PiCheckThin } from "react-icons/pi"
4-
import { Flex, Icon, Spinner, Text } from "@chakra-ui/react"
4+
5+
import { Flex, VStack } from "@/components/ui/flex"
6+
import { Spinner } from "@/components/ui/spinner"
7+
8+
import { cn } from "@/lib/utils/cn"
59

610
import { getMaxFractionDigitsUsd } from "../../utils"
711
import { WalletHome } from "../../WalletHome"
812
import type { TokenBalance } from "../../WalletHome/interfaces"
913

10-
const ICON_SIZE = "4.5rem" as const
14+
const ICON_SIZE = "size-4.5rem"
1115

1216
type SuccessProps = {
1317
tokenBalances: Array<TokenBalance>
@@ -72,55 +76,49 @@ export const Success = ({
7276
</motion.div>
7377
) : (
7478
<Flex
75-
animate={{ opacity: [0, 1] }}
76-
exit={{ opacity: 0 }}
77-
key="success-fade-out"
78-
as={motion.div}
79-
justify="center"
80-
h="full"
81-
bg="background.highlight"
82-
pt={{ base: 24, md: 0 }}
83-
alignItems={{ base: "start", md: "center" }}
79+
className="h-full justify-center bg-background-highlight max-md:pt-24 md:items-center"
80+
asChild
8481
>
85-
<Flex direction="column" alignItems="center" pt={8} gap={4}>
86-
{txPending ? (
87-
<motion.div
88-
key="spinner"
89-
initial={{ opacity: 0 }}
90-
animate={{ opacity: 1 }}
91-
transition={{ duration: 0.5 }}
92-
>
93-
<Spinner w={ICON_SIZE} h={ICON_SIZE} />
94-
</motion.div>
95-
) : (
96-
<motion.div
97-
key="checkmark"
98-
initial={{ scale: 0 }}
99-
animate={{ scale: 1 }}
100-
transition={{ type: "spring", delay: 0.25 }}
101-
>
102-
<Icon
103-
as={PiCheckThin}
104-
w={ICON_SIZE}
105-
h={ICON_SIZE}
106-
transform="rotate(-10deg)"
107-
/>
108-
</motion.div>
109-
)}
110-
<Text textAlign="center" px={{ base: 4, md: 8 }}>
82+
<motion.div
83+
animate={{ opacity: [0, 1] }}
84+
exit={{ opacity: 0 }}
85+
key="success-fade-out"
86+
>
87+
<VStack className="gap-4 pt-8">
11188
{txPending ? (
112-
"Sending transaction"
89+
<motion.div
90+
key="spinner"
91+
initial={{ opacity: 0 }}
92+
animate={{ opacity: 1 }}
93+
transition={{ duration: 0.5 }}
94+
>
95+
<Spinner className={ICON_SIZE} />
96+
</motion.div>
11397
) : (
114-
<Text as="span" data-testid="success-message">
115-
You sent{" "}
116-
<strong>
117-
<>{sentEthValue} ETH</>
118-
</strong>{" "}
119-
({usdValue}) to <strong>{recipient}</strong>
120-
</Text>
98+
<motion.div
99+
key="checkmark"
100+
initial={{ scale: 0 }}
101+
animate={{ scale: 1 }}
102+
transition={{ type: "spring", delay: 0.25 }}
103+
>
104+
<PiCheckThin className={cn(ICON_SIZE, "-rotate-[10deg]")} />
105+
</motion.div>
121106
)}
122-
</Text>
123-
</Flex>
107+
<p className="px-4 text-center md:px-8">
108+
{txPending ? (
109+
"Sending transaction"
110+
) : (
111+
<span data-testid="success-message">
112+
You sent{" "}
113+
<strong>
114+
<>{sentEthValue} ETH</>
115+
</strong>{" "}
116+
({usdValue}) to <strong>{recipient}</strong>
117+
</span>
118+
)}
119+
</p>
120+
</VStack>
121+
</motion.div>
124122
</Flex>
125123
)}
126124
</AnimatePresence>

0 commit comments

Comments
 (0)