From 8c44e7d05187ca105a5bacd5650218392a805e7b Mon Sep 17 00:00:00 2001 From: amit-ksh Date: Fri, 28 Apr 2023 12:28:07 +0530 Subject: [PATCH 1/2] refactor (pages-conditional): migrate dapps page to Chakra --- src/pages-conditional/dapps.tsx | 763 +++++++++++++++++--------------- 1 file changed, 412 insertions(+), 351 deletions(-) diff --git a/src/pages-conditional/dapps.tsx b/src/pages-conditional/dapps.tsx index 747c8b4f62d..4f4550c9809 100644 --- a/src/pages-conditional/dapps.tsx +++ b/src/pages-conditional/dapps.tsx @@ -1,5 +1,9 @@ -import React, { useRef, useState, useEffect } from "react" -import styled from "@emotion/styled" +import React, { + useRef, + useState, + useEffect, + ComponentPropsWithRef, +} from "react" import { GatsbyImage } from "gatsby-plugin-image" import { graphql, PageProps } from "gatsby" import { useI18next, useTranslation } from "gatsby-plugin-react-i18next" @@ -14,297 +18,336 @@ import GhostCard from "../components/GhostCard" import Link from "../components/Link" import InfoBanner from "../components/InfoBanner" import DocLink from "../components/DocLink" -import Emoji from "../components/OldEmoji" +import Emoji from "../components/Emoji" import ButtonLink from "../components/ButtonLink" import PageMetadata from "../components/PageMetadata" import ProductList from "../components/ProductList" import PageHero from "../components/PageHero" -import { - ButtonSecondary, - ButtonPrimary, - CardGrid, - Content, - Page, - CenterDivider, - Divider, - Option, - OptionContainer, - OptionText, -} from "../components/SharedStyledComponents" import FeedbackCard from "../components/FeedbackCard" import { getImage, getSrc } from "../utils/image" import { trackCustomEvent } from "../utils/matomo" -import { Context } from "../types" -import { Badge } from "@chakra-ui/react" - -const MagiciansImage = styled(GatsbyImage)` - background-size: cover; - background-repeat: no-repeat; - align-self: center; - width: 100%; - min-width: 240px; - max-width: 300px; - margin: 2rem 6rem; - @media (max-width: ${(props) => props.theme.breakpoints.m}) { - margin: 2rem 2rem; - } - @media (max-width: ${(props) => props.theme.breakpoints.s}) { - margin: 2rem 0rem; - } -` +import { ChildOnlyProp, Context } from "../types" +import { + Badge, + Box, + Button, + ButtonProps, + Divider as ChakraDivider, + DividerProps, + Flex, + FlexProps, + Heading, + HeadingProps, + SimpleGrid, + Text, + chakra, + useToken, +} from "@chakra-ui/react" -const ImageContainer = styled.div` - display: flex; - justify-content: center; -` +const Page = (props: ChildOnlyProp & FlexProps) => ( + +) -const StyledButtonSecondary = styled(ButtonSecondary)` - margin-top: 0; -` +const Divider = (props: DividerProps) => ( + +) -const StyledGhostCard = styled(GhostCard)` - .ghost-card-base { - display: flex; - justify-content: center; - } -` +const CenterDivider = () => -const Subtitle = styled.div` - font-size: 1.5rem; - line-height: 140%; - color: ${(props) => props.theme.colors.text200}; - margin-top: 1rem; - @media (max-width: ${(props) => props.theme.breakpoints.l}) { - font-size: 1.25rem; - } -` +const Content = (props: ChildOnlyProp) => ( + +) -const Row = styled.div` - display: flex; - width: 100%; - align-items: flex-start; - @media (max-width: ${(props) => props.theme.breakpoints.l}) { - flex-direction: column; - } -` +const OptionContainer = (props: ChildOnlyProp) => ( + +) -const IntroRow = styled.div` - display: flex; - width: 100%; - align-items: flex-start; - background: ${(props) => props.theme.colors.background}; - border-radius: 32px; - padding: 2rem; - @media (max-width: ${(props) => props.theme.breakpoints.l}) { - flex-direction: column; - } -` +const Option = ( + props: Pick & { isActive: boolean } +) => { + const [tableBoxShadow] = useToken("colors", ["tableBoxShadow"]) -const TwoColumnContent = styled.div` - display: flex; - align-items: flex-start; - width: 100%; - margin-right: 2rem; - @media (max-width: ${(props) => props.theme.breakpoints.l}) { - flex-direction: column; - align-items: flex-start; - margin-left: 0rem; - margin-right: 0rem; - } -` + return ( +