|
1 | 1 | import React from "react"
|
2 | 2 | import { motion } from "framer-motion"
|
3 | 3 | import { MdArrowBack } from "react-icons/md"
|
4 |
| -import { Box, Flex, Grid, Heading, Text } from "@chakra-ui/react" |
5 | 4 |
|
6 | 5 | import type { SimulatorNavProps } from "@/lib/types"
|
7 | 6 |
|
8 |
| -import { Button, ButtonLink } from "../Buttons" |
| 7 | +import { cn } from "@/lib/utils/cn" |
| 8 | + |
| 9 | +import { Button, ButtonLink } from "../ui/buttons/Button" |
| 10 | +import { Flex } from "../ui/flex" |
9 | 11 |
|
10 | 12 | import type {
|
11 | 13 | LabelHref,
|
@@ -43,74 +45,51 @@ export const Explanation = ({
|
43 | 45 | hidden: { opacity: 0 },
|
44 | 46 | }
|
45 | 47 | return (
|
46 |
| - <Flex direction="column" flex={1} zIndex={1}> |
| 48 | + <Flex className="z-[1] flex-1 flex-col"> |
47 | 49 | {/* Back button */}
|
48 | 50 | <Button
|
49 |
| - as={motion.button} |
50 | 51 | variant="ghost"
|
51 |
| - leftIcon={<MdArrowBack size="18px" />} |
52 |
| - sx={{ paddingInlineStart: 0 }} |
53 |
| - mt={{ base: -6, md: 0 }} |
54 |
| - mb={{ base: 2, md: 8 }} |
| 52 | + className={cn( |
| 53 | + "-mt-6 mb-2 w-fit ps-0 [transition-duration:10ms] md:mb-8 md:mt-0", |
| 54 | + step === 0 ? "pointer-events-none" : "pointer-events-auto" |
| 55 | + )} |
55 | 56 | onClick={regressStepper}
|
56 |
| - pointerEvents={step === 0 ? "none" : "all"} |
57 |
| - variants={backButtonVariants} |
58 |
| - initial="hidden" |
59 |
| - animate={step === 0 ? "hidden" : "visible"} |
60 |
| - transitionDuration="10ms" |
61 |
| - w="fit-content" |
| 57 | + asChild |
62 | 58 | >
|
63 |
| - Back |
| 59 | + <motion.button |
| 60 | + initial="hidden" |
| 61 | + variants={backButtonVariants} |
| 62 | + animate={step === 0 ? "hidden" : "visible"} |
| 63 | + > |
| 64 | + <MdArrowBack size="18px" /> |
| 65 | + Back |
| 66 | + </motion.button> |
64 | 67 | </Button>
|
65 |
| - <Flex direction={{ base: "row", md: "column" }} gap={{ base: 3, md: 2 }}> |
| 68 | + <Flex className="gap-3 md:flex-col md:gap-2"> |
66 | 69 | {/* Step counter */}
|
67 |
| - <Grid |
68 |
| - placeItems="center" |
69 |
| - bg="body.light" |
70 |
| - borderRadius="lg" |
71 |
| - p={2} |
72 |
| - w={9} |
73 |
| - h={8} |
74 |
| - fontSize="xs" |
75 |
| - > |
76 |
| - <Text as="span" lineHeight={1} fontWeight="bold" m={0}> |
| 70 | + <div className="grid h-8 w-9 place-items-center rounded-lg bg-body-light p-2 text-xs"> |
| 71 | + <span className="font-bold leading-none"> |
77 | 72 | {step + 1}/{totalSteps}
|
78 |
| - </Text> |
79 |
| - </Grid> |
| 73 | + </span> |
| 74 | + </div> |
80 | 75 | {/* Header and description */}
|
81 |
| - <Box> |
82 |
| - <Heading |
83 |
| - as="h3" |
84 |
| - fontSize={{ base: "xl", sm: "2xl", md: "3xl", lg: "4xl" }} |
85 |
| - lineHeight={{ base: 8, md: 10 }} |
86 |
| - mt={0} |
87 |
| - mb={{ base: 4, md: 8 }} |
88 |
| - > |
| 76 | + <div> |
| 77 | + <h3 className="mb-4 mt-0 text-xl leading-8 sm:text-2xl md:mb-8 md:text-3xl md:leading-10 lg:text-4xl"> |
89 | 78 | {header}
|
90 |
| - </Heading> |
| 79 | + </h3> |
91 | 80 | {description && (
|
92 |
| - <Box display={{ base: "block", md: "none" }} position="relative"> |
| 81 | + <div className="relative md:hidden"> |
93 | 82 | <MoreInfoPopover isFirstStep={nav.step === 0}>
|
94 |
| - <Box>{description}</Box> |
| 83 | + <div>{description}</div> |
95 | 84 | </MoreInfoPopover>
|
96 |
| - </Box> |
| 85 | + </div> |
97 | 86 | )}
|
98 |
| - </Box> |
| 87 | + </div> |
99 | 88 | </Flex>
|
100 |
| - {description && ( |
101 |
| - <Box display={{ base: "none", md: "block" }}>{description}</Box> |
102 |
| - )} |
| 89 | + {description && <div className="max-md:hidden">{description}</div>} |
103 | 90 | {/* Last step navigation buttons */}
|
104 | 91 | {isLastStep && (
|
105 |
| - <Flex |
106 |
| - direction="column" |
107 |
| - gap={4} |
108 |
| - maxW="300px" |
109 |
| - w="full" |
110 |
| - mx={{ base: "auto", md: 0 }} |
111 |
| - mt={4} |
112 |
| - zIndex={-1} |
113 |
| - > |
| 92 | + <Flex className="z-[-1] mx-auto mt-4 w-full max-w-[300px] flex-col gap-4 md:mx-0"> |
114 | 93 | {nextPathSummary && openPath && nextPathId && (
|
115 | 94 | <PathButton
|
116 | 95 | pathSummary={nextPathSummary}
|
|
0 commit comments