From 7f1479f24377b3485107419ae0f85a925c82e054 Mon Sep 17 00:00:00 2001 From: Corwin Smith Date: Tue, 14 Jan 2025 22:26:56 -0700 Subject: [PATCH] feat: migrate Card to tailwind --- src/components/Card/index.tsx | 50 +++++++++++++++++-------------- src/components/Trilemma/index.tsx | 4 +-- src/layouts/md/Translatathon.tsx | 3 +- src/pages/bug-bounty.tsx | 4 +-- src/pages/community.tsx | 6 +--- src/pages/dapps.tsx | 2 +- src/pages/developers/index.tsx | 14 +-------- src/pages/eth.tsx | 6 +--- src/pages/gas.tsx | 5 +--- src/pages/learn.tsx | 13 ++------ src/pages/roadmap/vision.tsx | 8 +---- src/pages/staking/index.tsx | 8 +---- src/pages/wallets/index.tsx | 6 +--- src/pages/what-is-ethereum.tsx | 5 +--- src/styles/semantic-tokens.css | 6 ++++ tailwind.config.ts | 2 ++ 16 files changed, 51 insertions(+), 91 deletions(-) diff --git a/src/components/Card/index.tsx b/src/components/Card/index.tsx index 27be3528caa..c1b7e914e14 100644 --- a/src/components/Card/index.tsx +++ b/src/components/Card/index.tsx @@ -1,40 +1,44 @@ import { ReactNode } from "react" -import { Heading, Stack, StackProps, Text } from "@chakra-ui/react" import Emoji from "@/components/Emoji" -export type CardProps = Omit & { +import { cn } from "@/lib/utils/cn" + +export type CardProps = { children?: ReactNode emoji?: string title?: ReactNode description?: ReactNode + className?: string } -const Card = ({ emoji, title, description, children, ...props }: CardProps) => ( - ( +
- +
{emoji && } - - {title && ( - - {title} - - )} - {description && {description}} - - +
+ {title &&

{title}

} + {description &&

{description}

} +
+
{children} -
+
) export default Card diff --git a/src/components/Trilemma/index.tsx b/src/components/Trilemma/index.tsx index 011519bf985..af0602b3a4c 100644 --- a/src/components/Trilemma/index.tsx +++ b/src/components/Trilemma/index.tsx @@ -35,11 +35,11 @@ const Trilemma = () => { {t("page-roadmap-vision-trilemma-modal-tip")}:

- +
- + Close ( emoji={emoji} title={title} description={description} - flex="1 1 30%" - p={6} + className="flex-[1_1_30%] p-6" /> ) diff --git a/src/pages/bug-bounty.tsx b/src/pages/bug-bounty.tsx index eac617b89b3..895a1ab6bde 100644 --- a/src/pages/bug-bounty.tsx +++ b/src/pages/bug-bounty.tsx @@ -254,7 +254,7 @@ const StyledCardContainer = (props: ChildOnlyProp) => ( ) const StyledCard = ({ children, ...props }) => ( - + {children} ) @@ -473,7 +473,7 @@ const BugBountiesPage = () => { title={t("page-upgrades-bug-bounty-meta-title")} description={t("page-upgrades-bug-bounty-meta-description")} /> - { /* TODO: Remove on the 25th of January */ } + {/* TODO: Remove on the 25th of January */} diff --git a/src/pages/community.tsx b/src/pages/community.tsx index 795146ca5e5..051ba9166a9 100644 --- a/src/pages/community.tsx +++ b/src/pages/community.tsx @@ -251,11 +251,7 @@ const CommunityPage = () => { {whyGetInvolvedCards.map((card, idx) => ( { {(categories[selectedCategory].benefits || []).map( (art, idx) => ( ( ) const StyledCard = (props: CardProps) => { - const tableBoxShadow = useColorModeValue("tableBox.light", "tableBox.dark") - return ( ) } diff --git a/src/pages/eth.tsx b/src/pages/eth.tsx index 9a71d8da556..c4f162a44cd 100644 --- a/src/pages/eth.tsx +++ b/src/pages/eth.tsx @@ -78,11 +78,7 @@ const Intro = (props: ChildOnlyProp) => ( const StyledCard = (props: ComponentProps) => ( ) diff --git a/src/pages/gas.tsx b/src/pages/gas.tsx index 68755473ea9..3bd01704209 100644 --- a/src/pages/gas.tsx +++ b/src/pages/gas.tsx @@ -70,10 +70,7 @@ const Page = (props: FlexProps) => ( export const StyledCard = (props: ComponentPropsWithRef) => ( ) diff --git a/src/pages/learn.tsx b/src/pages/learn.tsx index 64dba595f93..47bf7135f15 100644 --- a/src/pages/learn.tsx +++ b/src/pages/learn.tsx @@ -49,15 +49,7 @@ import whatIsEth from "@/public/images/what-is-ethereum.png" // TODO: Migrate the original Card component before updating this const Card = ({ children, ...props }: OriginalCardProps) => ( - + {children} ) @@ -454,8 +446,7 @@ const LearnPage = () => { diff --git a/src/pages/roadmap/vision.tsx b/src/pages/roadmap/vision.tsx index b0812af391d..84af95eaf85 100644 --- a/src/pages/roadmap/vision.tsx +++ b/src/pages/roadmap/vision.tsx @@ -89,13 +89,7 @@ const ProblemCardContainer = (props: ChildOnlyProp) => { const CentreCard = (props: ComponentPropsWithRef) => ( ) diff --git a/src/pages/staking/index.tsx b/src/pages/staking/index.tsx index 93b5a7b8b4b..135fbe8ec2a 100644 --- a/src/pages/staking/index.tsx +++ b/src/pages/staking/index.tsx @@ -108,13 +108,7 @@ const StyledCard = (props: { emoji={props.emoji} key={props.key} description={props.description} - sx={{ - justifyContent: "flex-start", - h3: { - fontWeight: "700", - margin: "0 0 1rem", - }, - }} + className="justify-start [&_h3]:mb-1 [&_h3]:mt-0 [&_h3]:font-bold" > {props.children} diff --git a/src/pages/wallets/index.tsx b/src/pages/wallets/index.tsx index 6ff5f83dc11..cddc9e1dd3a 100644 --- a/src/pages/wallets/index.tsx +++ b/src/pages/wallets/index.tsx @@ -107,11 +107,7 @@ const CardContainer = (props: BoxProps) => ( export const StyledCard = (props: ComponentPropsWithRef) => ( ) diff --git a/src/pages/what-is-ethereum.tsx b/src/pages/what-is-ethereum.tsx index 4e29ce31a5e..77072f8279f 100644 --- a/src/pages/what-is-ethereum.tsx +++ b/src/pages/what-is-ethereum.tsx @@ -384,10 +384,7 @@ const WhatIsEthereumPage = ({ emoji={card.emoji} title={card.title} description={card.description} - flex="1 1 30%" - minW="240px" - m={4} - p={6} + className="m-4 min-w-[240px] flex-[1_1_30%] p-6" /> ))} diff --git a/src/styles/semantic-tokens.css b/src/styles/semantic-tokens.css index 16342c17b26..6cc14df035c 100644 --- a/src/styles/semantic-tokens.css +++ b/src/styles/semantic-tokens.css @@ -126,6 +126,9 @@ --staking-blue-fill: #f1fcf5; --staking-red: #a0524c; --staking-red-fill: #f8fbf9; + + --edn-background: #f7f7f7; + --light-border: #ececec; } /* Dark mode token declarations */ @@ -224,5 +227,8 @@ --staking-blue-fill: #2b352f; --staking-red: #d6bbb9; --staking-red-fill: #313432; + + --edn-background: #1a1a1a; + --light-border: #404040; } } diff --git a/tailwind.config.ts b/tailwind.config.ts index 1d0e1f871de..b063ef96867 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -145,6 +145,8 @@ const config = { }, disabled: "hsla(var(--disabled))", + ednBackground: "var(--edn-background)", + lightBorder: "var(--light-border)", background: { DEFAULT: "hsla(var(--background))",