Skip to content

Commit c029ea5

Browse files
feat(Simulator/WalletHome/SendReceiveButtons): migrate to Tailwind
1 parent 75d421d commit c029ea5

File tree

2 files changed

+36
-51
lines changed

2 files changed

+36
-51
lines changed
Lines changed: 32 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,63 @@
1-
import React from "react"
2-
import {
3-
type As,
4-
Box,
5-
Grid,
6-
Icon,
7-
Text,
8-
type TextProps,
9-
} from "@chakra-ui/react"
1+
import { type ReactNode } from "react"
2+
import type { IconType } from "react-icons/lib"
3+
4+
import { Button } from "@/components/ui/buttons/Button"
5+
6+
import { cn } from "@/lib/utils/cn"
107

11-
import { Button } from "../../Buttons"
128
import { ClickAnimation } from "../ClickAnimation"
139
import { PulseAnimation } from "../PulseAnimation"
1410

15-
type SendReceiveButtonProps = Pick<TextProps, "children"> & {
16-
icon: As
11+
type SendReceiveButtonProps = {
12+
icon: IconType
1713
isHighlighted: boolean
1814
isDisabled: boolean
1915
onClick?: () => void
2016
isAnimated?: boolean
17+
children: ReactNode
2118
}
2219

2320
export const SendReceiveButton = ({
2421
children,
25-
icon,
22+
icon: Icon,
2623
isHighlighted,
2724
isDisabled,
2825
onClick,
2926
isAnimated,
3027
}: SendReceiveButtonProps) => (
3128
<Button
3229
variant="ghost"
33-
display="flex"
34-
flexDirection="column"
35-
alignItems="center"
30+
className="group flex-col items-center gap-4"
3631
data-group
37-
isDisabled={isDisabled}
32+
disabled={isDisabled}
3833
onClick={onClick}
39-
gap={4}
4034
>
41-
<Grid
42-
bg="primary.base"
43-
borderRadius="full"
44-
placeItems="center"
45-
w={{ base: 10, md: 16 }}
46-
aspectRatio={1}
47-
_groupHover={{ bg: "primary.hover" }}
48-
_groupDisabled={{
49-
background: isHighlighted ? "primary.base" : "body.light",
50-
}}
51-
position="relative"
35+
<div
36+
className={cn(
37+
"relative grid aspect-square w-10 place-items-center rounded-full bg-primary group-hover:bg-primary-hover md:w-16",
38+
isHighlighted
39+
? "group-disabled:bg-primary"
40+
: "group-disabled:bg-body-light"
41+
)}
5242
>
5343
{!isDisabled && isAnimated && <PulseAnimation type="circle" />}
54-
<Icon
55-
as={icon}
56-
w={{ base: 4, md: 6 }}
57-
h={{ base: 4, md: 6 }}
58-
color="background.base"
59-
/>
60-
</Grid>
61-
<Box position="relative">
62-
<Text
63-
fontWeight="bold"
64-
color="primary.base"
65-
textAlign="center"
66-
m={0}
67-
_groupHover={{ color: "primary.hover" }}
68-
_groupDisabled={{
69-
color: isHighlighted ? "primary.base" : "body.medium",
70-
}}
71-
position="relative"
44+
{/* TODO: Remove important flags from class utils when simulator icons are migrated to tailwind */}
45+
<Icon className="!size-4 !text-background md:!size-6" />
46+
</div>
47+
<div className="relative">
48+
<p
49+
className={cn(
50+
"relative text-center font-bold text-primary group-hover:text-primary-hover",
51+
isHighlighted
52+
? "group-disabled:text-primary"
53+
: "group-disabled:text-body-medium"
54+
)}
7255
>
7356
{children}
74-
</Text>
57+
</p>
7558
{!isDisabled && isAnimated && (
7659
<ClickAnimation below>click!</ClickAnimation>
7760
)}
78-
</Box>
61+
</div>
7962
</Button>
8063
)

src/components/Simulator/WalletHome/SendReceiveButtons.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react"
22
import { PiPaperPlaneRightFill } from "react-icons/pi"
3-
import { Flex } from "@chakra-ui/react"
3+
4+
import { Flex } from "@/components/ui/flex"
45

56
import { QrCodeIcon } from "../icons"
67
import type { SimulatorNav } from "../interfaces"
@@ -26,7 +27,7 @@ export const SendReceiveButtons = ({
2627
const highlightSend = !nav || !disableSend
2728
const highlightReceive = !nav || !disableReceive
2829
return (
29-
<Flex justify="space-around" w="full" gap={4}>
30+
<Flex className="w-full justify-around gap-4">
3031
<SendReceiveButton
3132
onClick={nav?.progressStepper}
3233
isDisabled={disableSend}
@@ -39,6 +40,7 @@ export const SendReceiveButtons = ({
3940
onClick={nav?.progressStepper}
4041
isDisabled={disableReceive}
4142
isHighlighted={highlightReceive}
43+
// @ts-expect-error icon component needs to be migrated to use react-icons base
4244
icon={QrCodeIcon}
4345
isAnimated
4446
>

0 commit comments

Comments
 (0)