11// Library imports
22import React , { useEffect , useState } from "react"
3- import styled from "@emotion/styled"
43import { graphql , PageProps } from "gatsby"
54import { useTranslation } from "gatsby-plugin-react-i18next"
65import { shuffle } from "lodash"
6+ import { Box , Flex , Heading , HeadingProps , Text } from "@chakra-ui/react"
77// Component imports
88import PageMetadata from "../../components/PageMetadata"
99import Translation from "../../components/Translation"
1010import ButtonLink from "../../components/ButtonLink"
1111import InfoBanner from "../../components/InfoBanner"
1212import CalloutBanner from "../../components/CalloutBanner"
13- import { Content , Page } from "../../components/SharedStyledComponents"
1413import FeedbackCard from "../../components/FeedbackCard"
1514import LearningToolsCardGrid from "../../components/LearningToolsCardGrid"
1615// Util imports
1716import { getImage } from "../../utils/image"
1817// Type imports
19- import { Context , LearningTool } from "../../types"
18+ import type { ChildOnlyProp , Context , LearningTool } from "../../types"
2019
21- // Styled components
22- const StyledPage = styled ( Page ) `
23- margin-top: 4rem;
24- `
20+ const Page = ( props : ChildOnlyProp ) => (
21+ < Flex
22+ direction = "column"
23+ align = "center"
24+ w = "full"
25+ mx = "auto"
26+ mt = { 16 }
27+ mb = { 0 }
28+ { ...props }
29+ />
30+ )
2531
26- const Header = styled . header `
27- display: flex;
28- flex-direction: column;
29- align-items: center;
30- text-align: center;
31- max-width: 896px;
32- padding: 0 2rem;
33- `
34- const H1 = styled . h1 `
35- margin: 2rem 0 0;
36- margin-top: 0;
37- color: ${ ( props ) => props . theme . colors . text } ;
38- font-style: normal;
39- font-family: ${ ( props ) => props . theme . fonts . monospace } ;
40- text-transform: uppercase;
41- font-weight: 600;
42- font-size: 2rem;
43- line-height: 1.4;
44- text-align: center;
45- `
32+ const Header = ( props : ChildOnlyProp ) => (
33+ < Flex
34+ as = "header"
35+ direction = "column"
36+ align = "center"
37+ textAlign = "center"
38+ maxW = "896px"
39+ py = { 0 }
40+ px = { 8 }
41+ { ...props }
42+ />
43+ )
4644
47- const Subtitle = styled . h2 `
48- font-size: 1.25rem;
49- line-height: 1.4;
50- font-weight: 400;
51- color: ${ ( props ) => props . theme . colors . text300 } ;
52- max-width: 55ch;
53- margin-bottom: 0.5rem;
54- margin-top: 1rem;
55- `
45+ const H1 = ( props : ChildOnlyProp ) => (
46+ < Heading
47+ as = "h1"
48+ my = { 0 }
49+ color = "text"
50+ fontStyle = "normal"
51+ fontFamily = "monospace"
52+ textTransform = "uppercase"
53+ fontWeight = "semibold"
54+ fontSize = "2rem"
55+ lineHeight = { 1.4 }
56+ textAlign = "center"
57+ { ...props }
58+ />
59+ )
5660
57- const SubtitleTwo = styled ( Subtitle ) `
58- margin-top: 0rem;
59- `
61+ const Subtitle = ( props : HeadingProps ) => (
62+ < Heading
63+ fontSize = "xl"
64+ lineHeight = { 1.4 }
65+ fontWeight = "normal"
66+ color = "text300"
67+ maxW = "55ch"
68+ mb = { 2 }
69+ mt = { 4 }
70+ { ...props }
71+ />
72+ )
6073
61- const StackContainer = styled ( Content ) `
62- border: 1px solid ${ ( props ) => props . theme . colors . border } ;
63- justify-content: flex-start;
64- border-radius: 4px;
65- padding: 3rem 2rem;
66- margin: 2rem;
67- width: 96%;
68- background: ${ ( props ) => props . theme . colors . ednBackground } ;
69- @media (max-width: ${ ( props ) => props . theme . breakpoints . s } ) {
70- width: 100%;
71- margin-left: 0rem;
72- margin-right: 0rem;
73- border-radius: 0px;
74- }
75- `
74+ const SubtitleTwo = ( props : ChildOnlyProp ) => < Subtitle mt = { 0 } { ...props } />
75+
76+ const ContentBox = ( props : ChildOnlyProp ) => (
77+ < Box py = { 4 } px = { 8 } w = "full" { ...props } />
78+ )
79+
80+ const StackContainer = ( props : ChildOnlyProp ) => (
81+ < Box
82+ border = "1px"
83+ borderColor = "border"
84+ borderRadius = { { base : 0 , sm : "base" } }
85+ w = { { base : "full" , sm : "96%" } }
86+ mx = { { base : 0 , sm : 8 } }
87+ my = { 8 }
88+ px = { 8 }
89+ py = { 12 }
90+ background = "ednBackground"
91+ { ...props }
92+ />
93+ )
7694
7795// Page component
7896const LearningToolsPage = ( {
@@ -260,7 +278,7 @@ const LearningToolsPage = ({
260278 ]
261279
262280 return (
263- < StyledPage >
281+ < Page >
264282 < PageMetadata
265283 title = { t ( "page-learning-tools-meta-title" ) }
266284 description = { t ( "page-learning-tools-meta-desc" ) }
@@ -277,9 +295,9 @@ const LearningToolsPage = ({
277295 < SubtitleTwo >
278296 < Translation id = "page-learning-tools-sandbox" />
279297 </ SubtitleTwo >
280- < p >
298+ < Text >
281299 < Translation id = "page-learning-tools-sandbox-desc" />
282- </ p >
300+ </ Text >
283301 < LearningToolsCardGrid category = { randomizedSandboxes } />
284302 < InfoBanner emoji = ":point_up:" shouldCenter >
285303 < Translation id = "page-learning-tools-remix-description-2" />
@@ -289,21 +307,21 @@ const LearningToolsPage = ({
289307 < SubtitleTwo >
290308 < Translation id = "page-learning-tools-game-tutorials" />
291309 </ SubtitleTwo >
292- < p >
310+ < Text >
293311 < Translation id = "page-learning-tools-game-tutorials-desc" />
294- </ p >
312+ </ Text >
295313 < LearningToolsCardGrid category = { games } />
296314 </ StackContainer >
297315 < StackContainer >
298316 < SubtitleTwo >
299317 < Translation id = "page-learning-tools-bootcamps" />
300318 </ SubtitleTwo >
301- < p >
319+ < Text >
302320 < Translation id = "page-learning-tools-bootcamps-desc" />
303- </ p >
321+ </ Text >
304322 < LearningToolsCardGrid category = { bootcamps } />
305323 </ StackContainer >
306- < Content >
324+ < ContentBox >
307325 < CalloutBanner
308326 mx = { 4 }
309327 mt = { 24 }
@@ -313,17 +331,17 @@ const LearningToolsPage = ({
313331 titleKey = { "page-learning-tools-documentation" }
314332 descriptionKey = { "page-learning-tools-documentation-desc" }
315333 >
316- < div >
334+ < Box >
317335 < ButtonLink to = "/developers/docs/" >
318336 < Translation id = "page-learning-tools-browse-docs" />
319337 </ ButtonLink >
320- </ div >
338+ </ Box >
321339 </ CalloutBanner >
322- </ Content >
323- < Content >
340+ </ ContentBox >
341+ < ContentBox >
324342 < FeedbackCard />
325- </ Content >
326- </ StyledPage >
343+ </ ContentBox >
344+ </ Page >
327345 )
328346}
329347
0 commit comments