Skip to content

Commit 4e75876

Browse files
feat(Simulator/screens/Slider): migrate to Tailwind
1 parent f2ad5e2 commit 4e75876

File tree

2 files changed

+26
-63
lines changed

2 files changed

+26
-63
lines changed

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

Lines changed: 25 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,75 @@
1-
import React from "react"
1+
import { type ReactNode } from "react"
22
import { motion } from "framer-motion"
33
import { PiCheckThin } from "react-icons/pi"
4-
import { Box, Flex, Grid, Icon, Text, TextProps } from "@chakra-ui/react"
4+
5+
import { HStack, VStack } from "@/components/ui/flex"
56

67
import { EthGlyphIcon } from "../../icons"
78

8-
type SliderProps = Pick<TextProps, "children"> & {
9+
type SliderProps = {
910
isConnected: boolean
1011
displayUrl: string
12+
children: ReactNode
1113
}
1214
export const Slider = ({ isConnected, displayUrl, children }: SliderProps) => {
13-
const ICON_SIZE = "4.5rem" as const
1415
return (
1516
<>
16-
<Box
17+
<motion.div
1718
key="backdrop"
18-
as={motion.div}
19-
position="absolute"
20-
inset={0}
21-
bg="blackAlpha.300"
22-
backdropFilter="blur(2px)"
19+
className="absolute inset-0 bg-black/15 backdrop-blur-[2px]"
2320
initial={{ opacity: 0 }}
2421
animate={{ opacity: 1 }}
2522
exit={{ opacity: 0 }}
2623
/>
2724
<motion.div
2825
key="slider"
29-
style={{ position: "absolute", height: "360px", width: "100%" }}
26+
className="absolute h-[360px] w-full"
3027
initial={{ bottom: "-100%" }}
3128
animate={{ bottom: 0 }}
3229
exit={{ bottom: "-100%" }}
3330
transition={{ duration: 0.75, ease: "easeOut" }}
3431
data-testid="slider-box"
3532
>
36-
<Flex
37-
direction="column"
38-
alignItems="center"
39-
px={6}
40-
py={8}
41-
h="full"
42-
w="full"
43-
bg="background.base"
44-
borderTopRadius="2xl"
45-
>
33+
<VStack className="size-full gap-0 rounded-t-2xl bg-background px-6 py-8">
4634
{isConnected ? (
47-
<Flex direction="column" alignItems="center" pt={8} gap={4}>
35+
<VStack className="gap-4 pt-8">
4836
<motion.div
4937
key="checkmark"
5038
initial={{ scale: 0 }}
5139
animate={{ scale: 1 }}
5240
transition={{ type: "spring", delay: 0.25 }}
5341
>
54-
<Icon
55-
as={PiCheckThin}
56-
w={ICON_SIZE}
57-
h={ICON_SIZE}
58-
transform="rotate(-10deg)"
59-
/>
42+
<PiCheckThin className="-rotate-[10deg] text-[4.5rem]" />
6043
</motion.div>
6144
<motion.div
6245
key="text"
6346
initial={{ opacity: 0 }}
6447
animate={{ opacity: 1 }}
6548
transition={{ delay: 0.15 }}
6649
>
67-
<Text textAlign="center" px={{ base: 4, md: 8 }}>
50+
<p className="px-4 text-center md:px-8">
6851
You&apos;re logged in!
69-
</Text>
52+
</p>
7053
</motion.div>
71-
</Flex>
54+
</VStack>
7255
) : (
7356
<>
74-
<Text textAlign="center" fontWeight="bold" fontSize="lg" mb={4}>
57+
<p className="mb-4 text-center text-lg font-bold">
7558
Connect account?
76-
</Text>
59+
</p>
7760
{/* URL Pill */}
78-
<Flex
79-
bg="blackAlpha.200"
80-
px={2}
81-
py={1}
82-
borderRadius="full"
83-
fontSize="xs"
84-
alignItems="center"
85-
gap={2}
86-
mb={6}
87-
>
88-
<Grid
89-
borderRadius="full"
90-
bg="body.base"
91-
w={5}
92-
h={5}
93-
placeItems="center"
94-
>
95-
<Icon
96-
as={EthGlyphIcon}
97-
color="background.base"
98-
fontSize="sm"
99-
/>
100-
</Grid>
101-
<Text mb={0} me={0.5}>
102-
{displayUrl}
103-
</Text>
104-
</Flex>
61+
<HStack className="mb-6 rounded-full bg-black/5 px-2 py-1 text-xs">
62+
<div className="grid size-5 place-items-center rounded-full bg-body">
63+
{/* TODO: Remove important flags and `size` class when icon is migrated */}
64+
<EthGlyphIcon className="!size-[1em] !text-sm !text-background" />
65+
</div>
66+
<p className="me-0.5">{displayUrl}</p>
67+
</HStack>
10568
{/* Information */}
106-
<Text>{children}</Text>
69+
<p>{children}</p>
10770
</>
10871
)}
109-
</Flex>
72+
</VStack>
11073
</motion.div>
11174
</>
11275
)

src/components/Simulator/screens/ConnectWeb3/__stories__/Slider.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const meta = {
99
component: SliderComponent,
1010
decorators: [
1111
(Story) => (
12-
<div className="relative h-[500px] w-[322px]">
12+
<div className="relative h-[500px] w-[322px] overflow-hidden">
1313
<Story />
1414
</div>
1515
),

0 commit comments

Comments
 (0)