Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Trilemma): update Chakra implementations #10490

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4126438
refactor(Trilemma): update Chakra implementations
TylerAPfledderer Jun 19, 2023
486c645
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Jul 1, 2023
2582190
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Jul 16, 2023
2b21194
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Jul 19, 2023
028cdc3
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Jul 19, 2023
da1989e
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Aug 2, 2023
5ad6453
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Aug 17, 2023
9f1e4c8
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Oct 21, 2023
83cc467
refactor(Trilemma): remove use of `useToken`
TylerAPfledderer Oct 21, 2023
6cfa88e
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Nov 3, 2023
96badf4
Merge branch 'dev' into refactor/trilemma-chakra-updates
TylerAPfledderer Nov 3, 2023
25cd136
Merge remote-tracking branch 'origin/dev' into refactor/trilemma-chak…
TylerAPfledderer Jan 27, 2024
241919c
Merge branch 'dev' into pr/10490
wackerow Feb 15, 2024
1ab06f9
style: use token, remove imports
wackerow Feb 15, 2024
6343bfa
fix(Trilemma): adjust structure and spacing
TylerAPfledderer Feb 15, 2024
8c15d56
Merge remote-tracking branch 'upstream/dev' into refactor/trilemma-ch…
TylerAPfledderer Feb 27, 2024
7e84e9e
Merge branch 'dev' into pr/10490
wackerow Mar 22, 2024
c891be7
refactor(Trilemma): use Chakra token for border radius
TylerAPfledderer Mar 25, 2024
048ce66
Update src/components/Trilemma/index.tsx
nloureiro Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions src/components/Trilemma/Triangle.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ReactNode } from "react"
import { useTranslation } from "next-i18next"
import { chakra, HTMLChakraProps } from "@chakra-ui/react"
import { chakra, forwardRef, HTMLChakraProps } from "@chakra-ui/react"

import { HandleClickParam } from "./useTrilemma"

Expand Down Expand Up @@ -35,19 +34,18 @@ export const TriangleSVG = ({
/>
)

const CircleSelect = ({ children, onClick }) => (
const CircleSelect = forwardRef((props, ref) => (
<chakra.g
ref={ref}
cursor="pointer"
sx={{
"circle:first-of-type": {
fill: "white",
},
}}
onClick={onClick}
>
{children}
</chakra.g>
)
{...props}
/>
))

const FillCircle = ({ isEthereum = false, isActive, ...rest }) => {
return (
Expand All @@ -66,9 +64,8 @@ export const TriangleSVG = ({

const Text = ({
isActive,
children,
...rest
}: { isActive: boolean; children: ReactNode } & HTMLChakraProps<"text">) => (
}: { isActive: boolean } & HTMLChakraProps<"text">) => (
<chakra.text
fill={isActive ? "primary400" : "text200"}
fontWeight={isActive ? 700 : 500}
Expand All @@ -77,9 +74,7 @@ export const TriangleSVG = ({
textTransform="uppercase"
transform={{ base: "translate(-80px, 0px)", sm: "none" }}
{...rest}
>
{children}
</chakra.text>
/>
)

const commonCircleStyles = {
Expand Down Expand Up @@ -117,7 +112,6 @@ export const TriangleSVG = ({
viewBox="-100 100 850 915"
fill="background.base"
width={{ base: "full", lg: "auto" }}
my={{ base: -28, sm: -16, lg: 0 }}
mt={{ lg: 32 }}
me={{ lg: 32 }}
>
Expand Down
63 changes: 27 additions & 36 deletions src/components/Trilemma/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
DrawerContent,
DrawerOverlay,
Flex,
Heading,
Hide,
useToken,
Stack,
Text,
} from "@chakra-ui/react"

import Card from "@/components/Card"
import OldHeading from "@/components/OldHeading"
import Text from "@/components/OldText"

import { TriangleSVG, TriangleSVGProps } from "./Triangle"
import { useTrilemma } from "./useTrilemma"
Expand All @@ -32,55 +32,46 @@ const Trilemma = () => {
...trilemmaChecks,
}

// TODO: Replace with direct token implementation after UI migration is completed
const lgBp = useToken("breakpoints", "lg")

return (
<Flex
alignItems="flex-start"
alignItems="center"
flexDirection={{ base: "column", lg: "row" }}
justifyContent="space-between"
wackerow marked this conversation as resolved.
Show resolved Hide resolved
columnGap="12"
rowGap="8"
>
<Flex
flexDirection="column"
my={{ base: 8, md: 12 }}
mx={{ md: 12 }}
py={8}
<Stack
spacing="8"
mt={{ base: "16", md: "20" }}
mb={{ lg: "20" }}
ms={{ md: "12" }}
me={{ md: "12", lg: 0 }}
flex={{
base: "1 1 100%",
lg: "0 1 500px",
}}
>
<OldHeading fontSize="2rem" mt={0}>
<Heading fontSize="2rem">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nloureiro Brought this up elsewhere, but more use of a non-standard font size

image

^ These are the sizes we have assigned to tokens right now... not requesting anything for this PR, just noting... card here

{t("page-roadmap-vision-trilemma-h2")}
</OldHeading>
<Text>{t("page-roadmap-vision-trilemma-p")}</Text>
<Text>{t("page-roadmap-vision-trilemma-p-1")}</Text>
<Text>{t("page-roadmap-vision-trilemma-p-2")}</Text>
<Text fontWeight={600} hideFrom={lgBp}>
{t("page-roadmap-vision-trilemma-modal-tip")}:
</Text>
<Card {...cardDetail} mt={8} minH="300px" hideBelow={lgBp} />
</Flex>
<Hide above={lgBp}>
</Heading>
<Flex flexDir="column" gap="6">
<Text>{t("page-roadmap-vision-trilemma-p")}</Text>
<Text>{t("page-roadmap-vision-trilemma-p-1")}</Text>
<Text>{t("page-roadmap-vision-trilemma-p-2")}</Text>
<Text fontWeight={600} hideFrom="lg">
{t("page-roadmap-vision-trilemma-modal-tip")}:
</Text>
</Flex>
<Card {...cardDetail} minH="300px" hideBelow="lg" mt="6" />
</Stack>
<Hide above="lg">
<Drawer
isOpen={mobileModalOpen}
onClose={handleModalClose}
placement="bottom"
>
<DrawerOverlay background="rgba(0,0,0,0.3)" />
<DrawerContent
border="none"
borderTopRadius="1rem"
background="background.base"
>
<Card
{...cardDetail}
background="none"
border="none"
justifyContent="flex-start"
my={8}
/>
<DrawerContent borderTopRadius="2xl" background="background.base">
<Card {...cardDetail} background="none" border="none" my="8" />
<DrawerCloseButton top="6" insetInlineEnd="6" />
</DrawerContent>
</Drawer>
Expand Down
Loading