Skip to content

Commit cf03b50

Browse files
committed
migrated: pages/developers/learning-tools.tsx to Chakra UI
1 parent 63fd198 commit cf03b50

File tree

1 file changed

+83
-58
lines changed

1 file changed

+83
-58
lines changed

src/pages/developers/learning-tools.tsx

Lines changed: 83 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,103 @@
11
// Library imports
22
import React, { useEffect, useState } from "react"
3-
import styled from "@emotion/styled"
43
import { graphql, PageProps } from "gatsby"
54
import { useTranslation } from "gatsby-plugin-react-i18next"
65
import { shuffle } from "lodash"
76
// 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"
1111
import InfoBanner from "../../components/InfoBanner"
1212
import CalloutBanner from "../../components/CalloutBanner"
13-
import { Content, Page } from "../../components/SharedStyledComponents"
1413
import FeedbackCard from "../../components/FeedbackCard"
1514
import LearningToolsCardGrid from "../../components/LearningToolsCardGrid"
1615
// Util imports
1716
import { getImage } from "../../utils/image"
1817
// Type imports
19-
import { Context, LearningTool } from "../../types"
18+
import { ChildOnlyProp, Context, LearningTool } from "../../types"
2019

21-
// Styled components
22-
const StyledPage = styled(Page)`
23-
margin-top: 4rem;
24-
`
20+
const StyledPage = (props: ChildOnlyProp) => (
21+
<Flex
22+
flexDirection="column"
23+
alignItems="center"
24+
w="100%"
25+
ml="auto"
26+
mr="auto"
27+
mb={16}
28+
mt={16}
29+
{...props}
30+
></Flex>
31+
)
2532

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-
`
33+
const Header = (props: ChildOnlyProp) => (
34+
<Flex
35+
flexDirection="column"
36+
alignItems="center"
37+
textAlign="center"
38+
maxW="896px"
39+
p={0}
40+
pl={8}
41+
pr={8}
42+
{...props}
43+
/>
44+
)
4645

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-
`
46+
const H1 = (props: ChildOnlyProp) => (
47+
<Flex
48+
m={"8 0 0"}
49+
mt={0}
50+
color="text"
51+
fontStyle="normal"
52+
fontFamily={"mono"}
53+
textTransform="uppercase"
54+
fontWeight="semibold"
55+
fontSize="4xl"
56+
lineHeight="1.4"
57+
textAlign="center"
58+
{...props}
59+
/>
60+
)
5661

57-
const SubtitleTwo = styled(Subtitle)`
58-
margin-top: 0rem;
59-
`
62+
const Subtitle = (props: ChildOnlyProp) => (
63+
<Flex
64+
fontSize={"xl"}
65+
lineHeight={"short"}
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) => (
75+
<Subtitle>
76+
<Box mt={0} {...props}></Box>
77+
</Subtitle>
78+
)
79+
80+
const ContentBox = (props: ChildOnlyProp) => (
81+
<Box pt={4} pb={4} pl={8} pr={8} w={"100%"} {...props}></Box>
82+
)
83+
84+
const StackContainer = (props: ChildOnlyProp) => (
85+
<Box
86+
border="1px solid border"
87+
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}
97+
background="ednBackground"
98+
{...props}
99+
></Box>
100+
)
76101

77102
// Page component
78103
const LearningToolsPage = ({
@@ -303,7 +328,7 @@ const LearningToolsPage = ({
303328
</p>
304329
<LearningToolsCardGrid category={bootcamps} />
305330
</StackContainer>
306-
<Content>
331+
<ContentBox>
307332
<CalloutBanner
308333
mx={4}
309334
mt={24}
@@ -319,10 +344,10 @@ const LearningToolsPage = ({
319344
</ButtonLink>
320345
</div>
321346
</CalloutBanner>
322-
</Content>
323-
<Content>
347+
</ContentBox>
348+
<ContentBox>
324349
<FeedbackCard />
325-
</Content>
350+
</ContentBox>
326351
</StyledPage>
327352
)
328353
}

0 commit comments

Comments
 (0)