|
1 | | -import React from "react" |
2 | | -import { |
3 | | - Box, |
4 | | - type FlexProps, |
5 | | - Text, |
6 | | - Icon, |
7 | | - Flex, |
8 | | - Grid, |
9 | | - Button, |
10 | | -} from "@chakra-ui/react" |
| 1 | +import React, { useEffect, useState } from "react" |
| 2 | +import { Box, type FlexProps, Text, Icon, Flex } from "@chakra-ui/react" |
11 | 3 | import { BsTriangle } from "react-icons/bs" |
12 | 4 | import { PiMagnifyingGlass } from "react-icons/pi" |
| 5 | +import { TbWorldWww } from "react-icons/tb" |
13 | 6 | import { IoEllipsisHorizontalSharp } from "react-icons/io5" |
14 | | -import { NFTSupportIcon } from "../../../icons/wallets/NFTSupportIcon" |
| 7 | +import { motion } from "framer-motion" |
15 | 8 | import { NotificationPopover } from "../../NotificationPopover" |
| 9 | +import { EXAMPLE_APP_URL } from "./constants" |
16 | 10 |
|
17 | 11 | interface IProps extends FlexProps { |
18 | 12 | progressStepper: () => void |
19 | 13 | } |
20 | 14 | export const Browser: React.FC<IProps> = ({ progressStepper, ...props }) => { |
| 15 | + const [typing, setTyping] = useState(false) |
| 16 | + useEffect(() => { |
| 17 | + const timeout = setTimeout(() => { |
| 18 | + setTyping(true) |
| 19 | + }, 3000) |
| 20 | + return () => clearTimeout(timeout) |
| 21 | + }, []) |
| 22 | + |
| 23 | + const sentence = { |
| 24 | + hidden: { opacity: 1 }, |
| 25 | + visible: { |
| 26 | + opacity: 1, |
| 27 | + transition: { staggerChildren: 0.12 }, |
| 28 | + }, |
| 29 | + } |
| 30 | + const letter = { |
| 31 | + hidden: { opacity: 0 }, |
| 32 | + visible: { opacity: 1, transition: { duration: 0 } }, |
| 33 | + } |
| 34 | + |
21 | 35 | return ( |
22 | 36 | <Flex direction="column" h="full" bg="body.light" {...props}> |
23 | 37 | <Box bg="background.highlight" w="full" px={3} pt={9} pb={3}> |
24 | 38 | <NotificationPopover |
25 | 39 | title="Example walkthrough" |
26 | 40 | content="Try logging into a real app with your wallet when finished here" |
27 | 41 | > |
28 | | - <Box bg="background.base" w="full" borderRadius="base" px={3} py={2}> |
29 | | - <Text color="disabled" cursor="default"> |
30 | | - Search or enter address |
31 | | - </Text> |
32 | | - </Box> |
33 | | - </NotificationPopover> |
34 | | - </Box> |
35 | | - <Box p={8} flex={1}> |
36 | | - <Button |
37 | | - variant="ghost" |
38 | | - display="flex" |
39 | | - flexDirection="column" |
40 | | - alignItems="center" |
41 | | - data-group |
42 | | - onClick={progressStepper} |
43 | | - gap={4} |
44 | | - p={0} |
45 | | - > |
46 | | - <Grid |
47 | | - bg="background.highlight" |
48 | | - borderRadius="lg" |
49 | | - placeItems="center" |
50 | | - w={16} |
51 | | - h={16} |
52 | | - _groupHover={{ bg: "primary.hover" }} |
| 42 | + <Flex |
| 43 | + bg="background.base" |
| 44 | + borderRadius="base" |
| 45 | + px={3} |
| 46 | + py={2} |
| 47 | + align="center" |
| 48 | + color="disabled" |
| 49 | + cursor="default" |
53 | 50 | > |
54 | | - <Icon |
55 | | - as={NFTSupportIcon} |
56 | | - color="body.base" |
57 | | - w={10} |
58 | | - h={10} |
59 | | - _groupHover={{ color: "background.base" }} |
60 | | - /> |
61 | | - </Grid> |
62 | | - <Box position="relative"> |
63 | | - <Text |
64 | | - fontWeight="bold" |
65 | | - color="body.base" |
66 | | - textAlign="center" |
67 | | - m={0} |
68 | | - _groupHover={{ color: "primary.hover" }} |
| 51 | + <Box |
| 52 | + borderInlineEnd="1px" |
| 53 | + borderColor="background.highlight" |
| 54 | + flex={1} |
69 | 55 | > |
70 | | - NFT Market |
71 | | - </Text> |
72 | | - </Box> |
73 | | - </Button> |
| 56 | + {typing ? ( |
| 57 | + <Text |
| 58 | + as={motion.p} |
| 59 | + variants={sentence} |
| 60 | + initial="hidden" |
| 61 | + animate="visible" |
| 62 | + color="body.medium" |
| 63 | + > |
| 64 | + {EXAMPLE_APP_URL.split("").map((char, index) => ( |
| 65 | + <motion.span key={char + "-" + index} variants={letter}> |
| 66 | + {char} |
| 67 | + </motion.span> |
| 68 | + ))} |
| 69 | + </Text> |
| 70 | + ) : ( |
| 71 | + <Text>Search or enter website</Text> |
| 72 | + )} |
| 73 | + </Box> |
| 74 | + <Icon as={TbWorldWww} ms={3} /> |
| 75 | + </Flex> |
| 76 | + </NotificationPopover> |
74 | 77 | </Box> |
| 78 | + |
| 79 | + <Flex flex={1} justify="center" pt={{ base: 20, md: 24 }}> |
| 80 | + <Icon as={TbWorldWww} fontSize="8xl" strokeWidth="1" color="disabled" /> |
| 81 | + </Flex> |
| 82 | + |
75 | 83 | <Flex |
76 | 84 | bg="background.highlight" |
77 | 85 | w="full" |
|
0 commit comments