From cf03b50a5e3a8a4cb5f574b62855aaa0f71435a4 Mon Sep 17 00:00:00 2001 From: Seek4samurai Date: Mon, 29 May 2023 19:14:30 +0530 Subject: [PATCH 1/3] migrated: pages/developers/learning-tools.tsx to Chakra UI --- src/pages/developers/learning-tools.tsx | 141 ++++++++++++++---------- 1 file changed, 83 insertions(+), 58 deletions(-) diff --git a/src/pages/developers/learning-tools.tsx b/src/pages/developers/learning-tools.tsx index 328b65ac382..ca17476f9b4 100644 --- a/src/pages/developers/learning-tools.tsx +++ b/src/pages/developers/learning-tools.tsx @@ -1,78 +1,103 @@ // Library imports import React, { useEffect, useState } from "react" -import styled from "@emotion/styled" import { graphql, PageProps } from "gatsby" import { useTranslation } from "gatsby-plugin-react-i18next" import { shuffle } from "lodash" // Component imports +import { Box, Flex } from "@chakra-ui/react" import PageMetadata from "../../components/PageMetadata" import Translation from "../../components/Translation" import ButtonLink from "../../components/ButtonLink" import InfoBanner from "../../components/InfoBanner" import CalloutBanner from "../../components/CalloutBanner" -import { Content, Page } from "../../components/SharedStyledComponents" import FeedbackCard from "../../components/FeedbackCard" import LearningToolsCardGrid from "../../components/LearningToolsCardGrid" // Util imports import { getImage } from "../../utils/image" // Type imports -import { Context, LearningTool } from "../../types" +import { ChildOnlyProp, Context, LearningTool } from "../../types" -// Styled components -const StyledPage = styled(Page)` - margin-top: 4rem; -` +const StyledPage = (props: ChildOnlyProp) => ( + +) -const Header = styled.header` - display: flex; - flex-direction: column; - align-items: center; - text-align: center; - max-width: 896px; - padding: 0 2rem; -` -const H1 = styled.h1` - margin: 2rem 0 0; - margin-top: 0; - color: ${(props) => props.theme.colors.text}; - font-style: normal; - font-family: ${(props) => props.theme.fonts.monospace}; - text-transform: uppercase; - font-weight: 600; - font-size: 2rem; - line-height: 1.4; - text-align: center; -` +const Header = (props: ChildOnlyProp) => ( + +) -const Subtitle = styled.h2` - font-size: 1.25rem; - line-height: 1.4; - font-weight: 400; - color: ${(props) => props.theme.colors.text300}; - max-width: 55ch; - margin-bottom: 0.5rem; - margin-top: 1rem; -` +const H1 = (props: ChildOnlyProp) => ( + +) -const SubtitleTwo = styled(Subtitle)` - margin-top: 0rem; -` +const Subtitle = (props: ChildOnlyProp) => ( + +) -const StackContainer = styled(Content)` - border: 1px solid ${(props) => props.theme.colors.border}; - justify-content: flex-start; - border-radius: 4px; - padding: 3rem 2rem; - margin: 2rem; - width: 96%; - background: ${(props) => props.theme.colors.ednBackground}; - @media (max-width: ${(props) => props.theme.breakpoints.s}) { - width: 100%; - margin-left: 0rem; - margin-right: 0rem; - border-radius: 0px; - } -` +const SubtitleTwo = (props: ChildOnlyProp) => ( + + + +) + +const ContentBox = (props: ChildOnlyProp) => ( + +) + +const StackContainer = (props: ChildOnlyProp) => ( + +) // Page component const LearningToolsPage = ({ @@ -303,7 +328,7 @@ const LearningToolsPage = ({

- + - - + + - + ) } From 2921289ebc236f96509c6eb1beb6865eda1c94c1 Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Mon, 19 Jun 2023 16:14:31 -0300 Subject: [PATCH 2/3] apply fixes from code review --- src/pages/developers/learning-tools.tsx | 98 ++++++++++++------------- 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/src/pages/developers/learning-tools.tsx b/src/pages/developers/learning-tools.tsx index ca17476f9b4..22f0febbdcc 100644 --- a/src/pages/developers/learning-tools.tsx +++ b/src/pages/developers/learning-tools.tsx @@ -3,8 +3,8 @@ import React, { useEffect, useState } from "react" import { graphql, PageProps } from "gatsby" import { useTranslation } from "gatsby-plugin-react-i18next" import { shuffle } from "lodash" +import { Box, Flex, Heading, HeadingProps, Text } from "@chakra-ui/react" // Component imports -import { Box, Flex } from "@chakra-ui/react" import PageMetadata from "../../components/PageMetadata" import Translation from "../../components/Translation" import ButtonLink from "../../components/ButtonLink" @@ -15,54 +15,54 @@ import LearningToolsCardGrid from "../../components/LearningToolsCardGrid" // Util imports import { getImage } from "../../utils/image" // Type imports -import { ChildOnlyProp, Context, LearningTool } from "../../types" +import type { ChildOnlyProp, Context, LearningTool } from "../../types" -const StyledPage = (props: ChildOnlyProp) => ( +const Page = (props: ChildOnlyProp) => ( + /> ) const Header = (props: ChildOnlyProp) => ( ) const H1 = (props: ChildOnlyProp) => ( - ) -const Subtitle = (props: ChildOnlyProp) => ( - ( + ( /> ) -const SubtitleTwo = (props: ChildOnlyProp) => ( - - - -) +const SubtitleTwo = (props: ChildOnlyProp) => const ContentBox = (props: ChildOnlyProp) => ( - + ) const StackContainer = (props: ChildOnlyProp) => ( + /> ) // Page component @@ -285,7 +279,7 @@ const LearningToolsPage = ({ ] return ( - + -

+ -

+ @@ -314,18 +308,18 @@ const LearningToolsPage = ({ -

+ -

+ -

+ -

+
@@ -338,17 +332,17 @@ const LearningToolsPage = ({ titleKey={"page-learning-tools-documentation"} descriptionKey={"page-learning-tools-documentation-desc"} > -
+ -
+
- + ) } From 751d3143cea97c05cef0445fd5e6d4289d3151fe Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Mon, 19 Jun 2023 16:16:29 -0300 Subject: [PATCH 3/3] Update src/pages/developers/learning-tools.tsx Co-authored-by: Joshua <62268199+minimalsm@users.noreply.github.com> --- src/pages/developers/learning-tools.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/developers/learning-tools.tsx b/src/pages/developers/learning-tools.tsx index 22f0febbdcc..150a6e578a7 100644 --- a/src/pages/developers/learning-tools.tsx +++ b/src/pages/developers/learning-tools.tsx @@ -81,7 +81,6 @@ const StackContainer = (props: ChildOnlyProp) => (