From a6a78875f4d7ab43a4f6ce757fc767f488b95cc0 Mon Sep 17 00:00:00 2001 From: baystef Date: Sat, 25 Jan 2025 17:39:34 +0100 Subject: [PATCH 1/2] refactor(community): migrate community page to tailwind/shadcn --- src/pages/community.tsx | 243 +++++++++++----------------------------- src/styles/global.css | 6 + tailwind.config.ts | 7 ++ 3 files changed, 76 insertions(+), 180 deletions(-) diff --git a/src/pages/community.tsx b/src/pages/community.tsx index 795146ca5e5..a69d8b6a56b 100644 --- a/src/pages/community.tsx +++ b/src/pages/community.tsx @@ -1,31 +1,25 @@ +import { BaseHTMLAttributes } from "react" import { GetStaticProps } from "next" import { useTranslation } from "next-i18next" import { serverSideTranslations } from "next-i18next/serverSideTranslations" -import { - Box, - Flex, - HeadingProps, - SimpleGrid, - Text, - useTheme, -} from "@chakra-ui/react" import { BasePageProps, ChildOnlyProp, Lang } from "@/lib/types" import { ICard, IGetInvolvedCard } from "@/lib/interfaces" import ActionCard from "@/components/ActionCard" -import ButtonLink, { ButtonLinkProps } from "@/components/Buttons/ButtonLink" import Callout from "@/components/Callout" import Card from "@/components/Card" import FeedbackCard from "@/components/FeedbackCard" import { HubHero } from "@/components/Hero" import type { HubHeroProps } from "@/components/Hero/HubHero" -import { Image } from "@/components/Image" +import { TwImage } from "@/components/Image" import MainArticle from "@/components/MainArticle" -import OldHeading from "@/components/OldHeading" import PageMetadata from "@/components/PageMetadata" +import { ButtonLink, ButtonLinkProps } from "@/components/ui/buttons/Button" import { Divider } from "@/components/ui/divider" +import { Flex } from "@/components/ui/flex" +import { cn } from "@/lib/utils/cn" import { existsNamespace } from "@/lib/utils/existsNamespace" import { getLastDeployDate } from "@/lib/utils/getLastDeployDate" import { getLocaleTimestamp } from "@/lib/utils/time" @@ -65,50 +59,29 @@ export const getStaticProps = (async ({ locale }) => { }) satisfies GetStaticProps const CardContainer = ({ children }: ChildOnlyProp) => { - return ( - - {children} - - ) + return {children} } const Content = ({ children }: ChildOnlyProp) => { - return ( - - {children} - - ) + return
{children}
} const Page = ({ children }: ChildOnlyProp) => { return ( - - {children} + + {children} ) } const ButtonRow = ({ children }: ChildOnlyProp) => { - return ( - - {children} - - ) + return {children} } const StyledButtonLink = ({ children, ...props }: ButtonLinkProps) => { return ( {children} @@ -118,55 +91,42 @@ const StyledButtonLink = ({ children, ...props }: ButtonLinkProps) => { const RowReverse = ({ children }: ChildOnlyProp) => { return ( - + {children} ) } const ImageContainer = ({ children }: ChildOnlyProp) => { - return ( - - {children} - - ) + return {children} } const Subtitle = ({ children }: ChildOnlyProp) => { - return ( - - {children} - - ) + return

{children}

} const FeatureContent = ({ children }: ChildOnlyProp) => { return ( - + {children} ) } -const H2 = ({ children, ...props }: HeadingProps) => { +const H2 = ({ + children, + className, + ...props +}: BaseHTMLAttributes) => { return ( - +

{children} - +

) } const CommunityPage = () => { const { t } = useTranslation("page-community") - const theme = useTheme() const cards: Array = [ { @@ -232,20 +192,9 @@ const CommunityPage = () => { /> - + - +

{t("page-community-why-get-involved-title")}

@@ -265,39 +214,26 @@ const CommunityPage = () => {
- - - - +
+
+ +

{t("page-community-get-involved-title")}

{t("page-community-get-involved-description")} - +
- {t("page-community-get-involved-image-alt")}
- +
{cards.map((card, idx) => ( { alt={card.alt} /> ))} - - - - +
+
+
+

{t("page-community-open-source")}

@@ -344,35 +268,18 @@ const CommunityPage = () => {
- {t("page-community-open-source-image-alt")}
- - + + - +

{t("page-community-contribute")}

{t("page-community-contribute-description")} @@ -390,94 +297,70 @@ const CommunityPage = () => {
- {t("page-index-internet-image-alt")}
- +

{t("page-community-support")}

{t("page-community-support-description")} - +
{t("page-community-support-button")} - +
- {t("page-community-support-alt")}
- - - + +
+

{t("page-community-try-ethereum")} - - +

+
- - +
{t("page-community-get-eth")} - - - + + - +
{t("page-community-explore-dapps")} - - +
+
diff --git a/src/styles/global.css b/src/styles/global.css index 029638072df..e5f81817086 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -43,6 +43,9 @@ rgba(145, 234, 228, 0.2) 100% ); --search-background: var(--background); + --home-box-turquoise: #ccfcff; + --home-box-pink: #ffe5f9; + --home-box-purple: #e8e8ff; } [data-theme="dark"] { @@ -71,6 +74,9 @@ rgba(134, 253, 232, 0.08) 100% ); --search-background: #4c4c4c; + --home-box-turquoise: #293233; + --home-box-pink: #332027; + --home-box-purple: #212131; } } diff --git a/tailwind.config.ts b/tailwind.config.ts index 1d0e1f871de..511f96c027d 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -218,6 +218,13 @@ const config = { "red-fill": "var(--staking-red-fill)", }, + //temporary + "home-box": { + turquoise: "var(--home-box-turquoise)", + pink: "var(--home-box-pink)", + purple: "var(--home-box-purple)", + }, + /** @deprecated */ "switch-background": "hsla(var(--switch-background))", // TODO: Migrate "tooltip-shadow": "var(--tooltip-shadow)", From a7a9829435a76143fad8547f585e7faf644ba13e Mon Sep 17 00:00:00 2001 From: baystef Date: Mon, 3 Feb 2025 10:09:52 +0100 Subject: [PATCH 2/2] refactor(styling): update to inline styling for custom colors --- src/pages/community.tsx | 8 ++++---- src/styles/global.css | 6 ------ tailwind.config.ts | 7 ------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/pages/community.tsx b/src/pages/community.tsx index a69d8b6a56b..18cb380cc7d 100644 --- a/src/pages/community.tsx +++ b/src/pages/community.tsx @@ -192,7 +192,7 @@ const CommunityPage = () => { /> - +

{t("page-community-why-get-involved-title")}

@@ -249,7 +249,7 @@ const CommunityPage = () => {
- +

{t("page-community-open-source")}

@@ -276,7 +276,7 @@ const CommunityPage = () => {
- + @@ -305,7 +305,7 @@ const CommunityPage = () => { - +

{t("page-community-support")}

diff --git a/src/styles/global.css b/src/styles/global.css index e5f81817086..029638072df 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -43,9 +43,6 @@ rgba(145, 234, 228, 0.2) 100% ); --search-background: var(--background); - --home-box-turquoise: #ccfcff; - --home-box-pink: #ffe5f9; - --home-box-purple: #e8e8ff; } [data-theme="dark"] { @@ -74,9 +71,6 @@ rgba(134, 253, 232, 0.08) 100% ); --search-background: #4c4c4c; - --home-box-turquoise: #293233; - --home-box-pink: #332027; - --home-box-purple: #212131; } } diff --git a/tailwind.config.ts b/tailwind.config.ts index 511f96c027d..1d0e1f871de 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -218,13 +218,6 @@ const config = { "red-fill": "var(--staking-red-fill)", }, - //temporary - "home-box": { - turquoise: "var(--home-box-turquoise)", - pink: "var(--home-box-pink)", - purple: "var(--home-box-purple)", - }, - /** @deprecated */ "switch-background": "hsla(var(--switch-background))", // TODO: Migrate "tooltip-shadow": "var(--tooltip-shadow)",