Skip to content

Commit 953aa43

Browse files
feat(Simulator/screens/ConnectWeb3): migrate to TailwindCSS
1 parent 384cbc6 commit 953aa43

File tree

2 files changed

+33
-70
lines changed

2 files changed

+33
-70
lines changed

src/components/Simulator/screens/ConnectWeb3/index.tsx

Lines changed: 27 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import React, { useEffect, useMemo, useState } from "react"
1+
import { useEffect, useMemo, useState } from "react"
22
import { AnimatePresence, motion } from "framer-motion"
33
import {
44
RiAuctionLine,
55
RiFileTransferLine,
66
RiPriceTag2Line,
77
} from "react-icons/ri"
8-
import { Box, Button, Flex, Icon, Text } from "@chakra-ui/react"
98

109
import type { PhoneScreenProps } from "@/lib/types"
1110

12-
import { Image } from "@/components/Image"
11+
import { TwImage as Image } from "@/components/Image"
12+
import { Button } from "@/components/ui/buttons/Button"
13+
import { Flex } from "@/components/ui/flex"
1314

1415
import { useEthPrice } from "../../../../hooks/useEthPrice"
1516
import {
@@ -80,36 +81,17 @@ export const ConnectWeb3 = ({ nav, ctaLabel }: PhoneScreenProps) => {
8081
{[0].includes(step) && <Browser />}
8182
{[1, 2, 3].includes(step) && (
8283
<Web3App displayUrl={EXAMPLE_APP_URL}>
83-
<Flex
84-
px={6}
85-
py={{ base: 8, md: 16 }}
86-
gap={{ base: 8, md: 16 }}
87-
bg="background.highlight"
88-
h="full"
89-
direction="column"
90-
textAlign="center"
91-
>
92-
<Text
93-
as={motion.p}
94-
fontSize={{ base: "xl", md: "2xl" }}
95-
m={0}
84+
<Flex className="bg-background.highlight h-full flex-col gap-8 px-6 py-8 text-center md:gap-16 md:py-16">
85+
<motion.p
86+
className="text-xl leading-[1.4] duration-700 md:text-2xl"
9687
{...fadeInProps}
97-
transitionDuration="0.75s"
98-
lineHeight={1.4}
9988
>
10089
Welcome to Web3
101-
<Text as="span" display="block" mt={2} fontWeight="bold">
102-
NFT Marketplace
103-
</Text>
104-
</Text>
105-
<Text
106-
as={motion.p}
107-
{...fadeInProps}
108-
transitionDuration="0.75s"
109-
transitionDelay="0.5s"
110-
>
90+
<span className="mt-2 block font-bold">NFT Marketplace</span>
91+
</motion.p>
92+
<motion.p className="delay-500 duration-700" {...fadeInProps}>
11193
Connect your wallet to view your collection
112-
</Text>
94+
</motion.p>
11395
</Flex>
11496
</Web3App>
11597
)}
@@ -132,16 +114,9 @@ export const ConnectWeb3 = ({ nav, ctaLabel }: PhoneScreenProps) => {
132114
appName="NFT Marketplace"
133115
displayUrl="app.example.com"
134116
>
135-
<Box
136-
px={6}
137-
py={{ base: 2, md: 6 }}
138-
fontSize="lg"
139-
sx={{ button: { textDecoration: "none" } }}
140-
>
141-
<Text fontWeight="bold" mb={4}>
142-
Your collection (1)
143-
</Text>
144-
<Flex gap={2} mb={6}>
117+
<div className="px-6 py-2 text-lg md:py-6 [&_button]:no-underline">
118+
<p className="mb-4 font-bold">Your collection (1)</p>
119+
<Flex className="mb-6 gap-2">
145120
<Image
146121
src={NFTs[0].image}
147122
width={120}
@@ -153,35 +128,18 @@ export const ConnectWeb3 = ({ nav, ctaLabel }: PhoneScreenProps) => {
153128
content="These are some things you could do as the owner of your NFTs"
154129
side="top"
155130
>
156-
<Flex
157-
direction="column"
158-
fontSize={{ base: "xs", sm: "sm" }}
159-
textAlign="start"
160-
alignItems="start"
161-
gap={1}
162-
>
163-
<Text fontWeight="bold" fontSize="md" mb="auto" ms={2}>
164-
Cool art
165-
</Text>
166-
<Button
167-
variant="link"
168-
isDisabled
169-
leftIcon={<Icon as={RiAuctionLine} fontSize="xs" />}
170-
>
131+
<Flex className="flex-col items-start gap-1 text-start text-xs sm:text-sm">
132+
<p className="mb-auto ms-2 text-md font-bold">Cool art</p>
133+
<Button variant="link" disabled>
134+
<RiAuctionLine className="text-xs" />
171135
Set a price
172136
</Button>
173-
<Button
174-
variant="link"
175-
isDisabled
176-
leftIcon={<Icon as={RiPriceTag2Line} fontSize="xs" />}
177-
>
137+
<Button variant="link" disabled>
138+
<RiPriceTag2Line className="text-xs" />
178139
Auction item
179140
</Button>
180-
<Button
181-
variant="link"
182-
isDisabled
183-
leftIcon={<Icon as={RiFileTransferLine} fontSize="xs" />}
184-
>
141+
<Button variant="link" disabled>
142+
<RiFileTransferLine className="text-xs" />
185143
Transfer item
186144
</Button>
187145
</Flex>
@@ -192,16 +150,16 @@ export const ConnectWeb3 = ({ nav, ctaLabel }: PhoneScreenProps) => {
192150
content="Try out a real Ethereum application when finished here"
193151
side="top"
194152
>
195-
<Box fontSize={{ base: "sm", md: "md" }}>
196-
<Button variant="link" isDisabled display="block">
153+
<div className="text-sm md:text-md">
154+
<Button className="block" variant="link" disabled>
197155
Browse other artwork
198156
</Button>
199-
<Button variant="link" isDisabled>
157+
<Button variant="link" disabled>
200158
Mint new NFT
201159
</Button>
202-
</Box>
160+
</div>
203161
</NotificationPopover>
204-
</Box>
162+
</div>
205163
</Web3App>
206164
</motion.div>
207165
)}

src/components/ui/buttons/Button.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const buttonVariants = cva(
3636
),
3737
outline: "", // Base styling
3838
ghost: "border-transparent hover:shadow-none",
39-
link: "border-transparent hover:shadow-none underline py-0 px-1 active:text-primary",
39+
link: "border-transparent hover:shadow-none underline !min-h-0 !py-0 !px-1 active:text-primary",
4040
},
4141
size: {
4242
lg: "text-lg py-3 px-8 [&>svg]:text-2xl rounded-lg focus-visible:rounded-lg",
@@ -102,13 +102,18 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
102102
},
103103
ref
104104
) => {
105+
console.log("🚀 ~ variant:", variant)
105106
const handleOnClick = (e: React.MouseEvent<HTMLButtonElement>) => {
106107
toId && scrollIntoView(toId)
107108
customEventOptions && trackCustomEvent(customEventOptions)
108109

109110
onClick?.(e)
110111
}
111112

113+
console.log(
114+
"🚀 ~ buttonVariants({ variant, size, className }):",
115+
buttonVariants({ variant, size, className })
116+
)
112117
const Comp = asChild ? Slot : "button"
113118
return (
114119
<Comp

0 commit comments

Comments
 (0)