Skip to content

Commit 2921289

Browse files
committed
apply fixes from code review
1 parent fb592cd commit 2921289

File tree

1 file changed

+46
-52
lines changed

1 file changed

+46
-52
lines changed

src/pages/developers/learning-tools.tsx

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import React, { useEffect, useState } from "react"
33
import { graphql, PageProps } from "gatsby"
44
import { useTranslation } from "gatsby-plugin-react-i18next"
55
import { shuffle } from "lodash"
6+
import { Box, Flex, Heading, HeadingProps, Text } from "@chakra-ui/react"
67
// Component imports
7-
import { Box, Flex } from "@chakra-ui/react"
88
import PageMetadata from "../../components/PageMetadata"
99
import Translation from "../../components/Translation"
1010
import ButtonLink from "../../components/ButtonLink"
@@ -15,54 +15,54 @@ import LearningToolsCardGrid from "../../components/LearningToolsCardGrid"
1515
// Util imports
1616
import { getImage } from "../../utils/image"
1717
// Type imports
18-
import { ChildOnlyProp, Context, LearningTool } from "../../types"
18+
import type { ChildOnlyProp, Context, LearningTool } from "../../types"
1919

20-
const StyledPage = (props: ChildOnlyProp) => (
20+
const Page = (props: ChildOnlyProp) => (
2121
<Flex
22-
flexDirection="column"
23-
alignItems="center"
24-
w="100%"
25-
ml="auto"
26-
mr="auto"
27-
mb={16}
22+
direction="column"
23+
align="center"
24+
w="full"
25+
mx="auto"
2826
mt={16}
27+
mb={0}
2928
{...props}
30-
></Flex>
29+
/>
3130
)
3231

3332
const Header = (props: ChildOnlyProp) => (
3433
<Flex
35-
flexDirection="column"
36-
alignItems="center"
34+
as="header"
35+
direction="column"
36+
align="center"
3737
textAlign="center"
3838
maxW="896px"
39-
p={0}
40-
pl={8}
41-
pr={8}
39+
py={0}
40+
px={8}
4241
{...props}
4342
/>
4443
)
4544

4645
const H1 = (props: ChildOnlyProp) => (
47-
<Flex
48-
m={"8 0 0"}
49-
mt={0}
46+
<Heading
47+
as="h1"
48+
my={0}
5049
color="text"
5150
fontStyle="normal"
52-
fontFamily={"mono"}
51+
fontFamily="monospace"
5352
textTransform="uppercase"
5453
fontWeight="semibold"
55-
fontSize="4xl"
56-
lineHeight="1.4"
54+
fontSize="2rem"
55+
lineHeight={1.4}
5756
textAlign="center"
5857
{...props}
5958
/>
6059
)
6160

62-
const Subtitle = (props: ChildOnlyProp) => (
63-
<Flex
64-
fontSize={"xl"}
65-
lineHeight={"short"}
61+
const Subtitle = (props: HeadingProps) => (
62+
<Heading
63+
fontSize="xl"
64+
lineHeight={1.4}
65+
fontWeight="normal"
6666
color="text300"
6767
maxW="55ch"
6868
mb={2}
@@ -71,32 +71,26 @@ const Subtitle = (props: ChildOnlyProp) => (
7171
/>
7272
)
7373

74-
const SubtitleTwo = (props: ChildOnlyProp) => (
75-
<Subtitle>
76-
<Box mt={0} {...props}></Box>
77-
</Subtitle>
78-
)
74+
const SubtitleTwo = (props: ChildOnlyProp) => <Subtitle mt={0} {...props} />
7975

8076
const ContentBox = (props: ChildOnlyProp) => (
81-
<Box pt={4} pb={4} pl={8} pr={8} w={"100%"} {...props}></Box>
77+
<Box py={4} px={8} w="full" {...props} />
8278
)
8379

8480
const StackContainer = (props: ChildOnlyProp) => (
8581
<Box
86-
border="1px solid border"
82+
border="1px"
83+
borderColor="border"
8784
justifyContent="flex-start"
88-
borderRadius={{ base: "4px", sm: "0" }}
89-
w={{ base: "96%", sm: "100%" }}
90-
m={8}
91-
ml={{ base: 8, sm: 0 }}
92-
mr={{ base: 8, sm: 0 }}
93-
pt={12}
94-
pb={12}
95-
pl={8}
96-
pr={8}
85+
borderRadius={{ base: 0, sm: "base" }}
86+
w={{ base: "full", sm: "96%" }}
87+
mx={{ base: 0, sm: 8 }}
88+
my={8}
89+
px={8}
90+
py={12}
9791
background="ednBackground"
9892
{...props}
99-
></Box>
93+
/>
10094
)
10195

10296
// Page component
@@ -285,7 +279,7 @@ const LearningToolsPage = ({
285279
]
286280

287281
return (
288-
<StyledPage>
282+
<Page>
289283
<PageMetadata
290284
title={t("page-learning-tools-meta-title")}
291285
description={t("page-learning-tools-meta-desc")}
@@ -302,9 +296,9 @@ const LearningToolsPage = ({
302296
<SubtitleTwo>
303297
<Translation id="page-learning-tools-sandbox" />
304298
</SubtitleTwo>
305-
<p>
299+
<Text>
306300
<Translation id="page-learning-tools-sandbox-desc" />
307-
</p>
301+
</Text>
308302
<LearningToolsCardGrid category={randomizedSandboxes} />
309303
<InfoBanner emoji=":point_up:" shouldCenter>
310304
<Translation id="page-learning-tools-remix-description-2" />
@@ -314,18 +308,18 @@ const LearningToolsPage = ({
314308
<SubtitleTwo>
315309
<Translation id="page-learning-tools-game-tutorials" />
316310
</SubtitleTwo>
317-
<p>
311+
<Text>
318312
<Translation id="page-learning-tools-game-tutorials-desc" />
319-
</p>
313+
</Text>
320314
<LearningToolsCardGrid category={games} />
321315
</StackContainer>
322316
<StackContainer>
323317
<SubtitleTwo>
324318
<Translation id="page-learning-tools-bootcamps" />
325319
</SubtitleTwo>
326-
<p>
320+
<Text>
327321
<Translation id="page-learning-tools-bootcamps-desc" />
328-
</p>
322+
</Text>
329323
<LearningToolsCardGrid category={bootcamps} />
330324
</StackContainer>
331325
<ContentBox>
@@ -338,17 +332,17 @@ const LearningToolsPage = ({
338332
titleKey={"page-learning-tools-documentation"}
339333
descriptionKey={"page-learning-tools-documentation-desc"}
340334
>
341-
<div>
335+
<Box>
342336
<ButtonLink to="/developers/docs/">
343337
<Translation id="page-learning-tools-browse-docs" />
344338
</ButtonLink>
345-
</div>
339+
</Box>
346340
</CalloutBanner>
347341
</ContentBox>
348342
<ContentBox>
349343
<FeedbackCard />
350344
</ContentBox>
351-
</StyledPage>
345+
</Page>
352346
)
353347
}
354348

0 commit comments

Comments
 (0)