1
1
// Library imports
2
2
import React , { useEffect , useState } from "react"
3
- import styled from "@emotion/styled"
4
3
import { graphql , PageProps } from "gatsby"
5
4
import { useTranslation } from "gatsby-plugin-react-i18next"
6
5
import { shuffle } from "lodash"
6
+ import { Box , Flex , Heading , HeadingProps , Text } from "@chakra-ui/react"
7
7
// Component imports
8
8
import PageMetadata from "../../components/PageMetadata"
9
9
import Translation from "../../components/Translation"
10
10
import ButtonLink from "../../components/ButtonLink"
11
11
import InfoBanner from "../../components/InfoBanner"
12
12
import CalloutBanner from "../../components/CalloutBanner"
13
- import { Content , Page } from "../../components/SharedStyledComponents"
14
13
import FeedbackCard from "../../components/FeedbackCard"
15
14
import LearningToolsCardGrid from "../../components/LearningToolsCardGrid"
16
15
// Util imports
17
16
import { getImage } from "../../utils/image"
18
17
// Type imports
19
- import { Context , LearningTool } from "../../types"
18
+ import type { ChildOnlyProp , Context , LearningTool } from "../../types"
20
19
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
+ )
25
31
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
+ )
46
44
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
+ )
56
60
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
+ )
60
73
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
+ )
76
94
77
95
// Page component
78
96
const LearningToolsPage = ( {
@@ -260,7 +278,7 @@ const LearningToolsPage = ({
260
278
]
261
279
262
280
return (
263
- < StyledPage >
281
+ < Page >
264
282
< PageMetadata
265
283
title = { t ( "page-learning-tools-meta-title" ) }
266
284
description = { t ( "page-learning-tools-meta-desc" ) }
@@ -277,9 +295,9 @@ const LearningToolsPage = ({
277
295
< SubtitleTwo >
278
296
< Translation id = "page-learning-tools-sandbox" />
279
297
</ SubtitleTwo >
280
- < p >
298
+ < Text >
281
299
< Translation id = "page-learning-tools-sandbox-desc" />
282
- </ p >
300
+ </ Text >
283
301
< LearningToolsCardGrid category = { randomizedSandboxes } />
284
302
< InfoBanner emoji = ":point_up:" shouldCenter >
285
303
< Translation id = "page-learning-tools-remix-description-2" />
@@ -289,21 +307,21 @@ const LearningToolsPage = ({
289
307
< SubtitleTwo >
290
308
< Translation id = "page-learning-tools-game-tutorials" />
291
309
</ SubtitleTwo >
292
- < p >
310
+ < Text >
293
311
< Translation id = "page-learning-tools-game-tutorials-desc" />
294
- </ p >
312
+ </ Text >
295
313
< LearningToolsCardGrid category = { games } />
296
314
</ StackContainer >
297
315
< StackContainer >
298
316
< SubtitleTwo >
299
317
< Translation id = "page-learning-tools-bootcamps" />
300
318
</ SubtitleTwo >
301
- < p >
319
+ < Text >
302
320
< Translation id = "page-learning-tools-bootcamps-desc" />
303
- </ p >
321
+ </ Text >
304
322
< LearningToolsCardGrid category = { bootcamps } />
305
323
</ StackContainer >
306
- < Content >
324
+ < ContentBox >
307
325
< CalloutBanner
308
326
mx = { 4 }
309
327
mt = { 24 }
@@ -313,17 +331,17 @@ const LearningToolsPage = ({
313
331
titleKey = { "page-learning-tools-documentation" }
314
332
descriptionKey = { "page-learning-tools-documentation-desc" }
315
333
>
316
- < div >
334
+ < Box >
317
335
< ButtonLink to = "/developers/docs/" >
318
336
< Translation id = "page-learning-tools-browse-docs" />
319
337
</ ButtonLink >
320
- </ div >
338
+ </ Box >
321
339
</ CalloutBanner >
322
- </ Content >
323
- < Content >
340
+ </ ContentBox >
341
+ < ContentBox >
324
342
< FeedbackCard />
325
- </ Content >
326
- </ StyledPage >
343
+ </ ContentBox >
344
+ </ Page >
327
345
)
328
346
}
329
347
0 commit comments