|
1 |
| -import React from "react" |
| 1 | +import { type ReactNode } from "react" |
2 | 2 | import { motion } from "framer-motion"
|
3 | 3 | 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" |
5 | 6 |
|
6 | 7 | import { EthGlyphIcon } from "../../icons"
|
7 | 8 |
|
8 |
| -type SliderProps = Pick<TextProps, "children"> & { |
| 9 | +type SliderProps = { |
9 | 10 | isConnected: boolean
|
10 | 11 | displayUrl: string
|
| 12 | + children: ReactNode |
11 | 13 | }
|
12 | 14 | export const Slider = ({ isConnected, displayUrl, children }: SliderProps) => {
|
13 |
| - const ICON_SIZE = "4.5rem" as const |
14 | 15 | return (
|
15 | 16 | <>
|
16 |
| - <Box |
| 17 | + <motion.div |
17 | 18 | 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]" |
23 | 20 | initial={{ opacity: 0 }}
|
24 | 21 | animate={{ opacity: 1 }}
|
25 | 22 | exit={{ opacity: 0 }}
|
26 | 23 | />
|
27 | 24 | <motion.div
|
28 | 25 | key="slider"
|
29 |
| - style={{ position: "absolute", height: "360px", width: "100%" }} |
| 26 | + className="absolute h-[360px] w-full" |
30 | 27 | initial={{ bottom: "-100%" }}
|
31 | 28 | animate={{ bottom: 0 }}
|
32 | 29 | exit={{ bottom: "-100%" }}
|
33 | 30 | transition={{ duration: 0.75, ease: "easeOut" }}
|
34 | 31 | data-testid="slider-box"
|
35 | 32 | >
|
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"> |
46 | 34 | {isConnected ? (
|
47 |
| - <Flex direction="column" alignItems="center" pt={8} gap={4}> |
| 35 | + <VStack className="gap-4 pt-8"> |
48 | 36 | <motion.div
|
49 | 37 | key="checkmark"
|
50 | 38 | initial={{ scale: 0 }}
|
51 | 39 | animate={{ scale: 1 }}
|
52 | 40 | transition={{ type: "spring", delay: 0.25 }}
|
53 | 41 | >
|
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]" /> |
60 | 43 | </motion.div>
|
61 | 44 | <motion.div
|
62 | 45 | key="text"
|
63 | 46 | initial={{ opacity: 0 }}
|
64 | 47 | animate={{ opacity: 1 }}
|
65 | 48 | transition={{ delay: 0.15 }}
|
66 | 49 | >
|
67 |
| - <Text textAlign="center" px={{ base: 4, md: 8 }}> |
| 50 | + <p className="px-4 text-center md:px-8"> |
68 | 51 | You're logged in!
|
69 |
| - </Text> |
| 52 | + </p> |
70 | 53 | </motion.div>
|
71 |
| - </Flex> |
| 54 | + </VStack> |
72 | 55 | ) : (
|
73 | 56 | <>
|
74 |
| - <Text textAlign="center" fontWeight="bold" fontSize="lg" mb={4}> |
| 57 | + <p className="mb-4 text-center text-lg font-bold"> |
75 | 58 | Connect account?
|
76 |
| - </Text> |
| 59 | + </p> |
77 | 60 | {/* 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> |
105 | 68 | {/* Information */}
|
106 |
| - <Text>{children}</Text> |
| 69 | + <p>{children}</p> |
107 | 70 | </>
|
108 | 71 | )}
|
109 |
| - </Flex> |
| 72 | + </VStack> |
110 | 73 | </motion.div>
|
111 | 74 | </>
|
112 | 75 | )
|
|
0 commit comments