Skip to content

Commit 39d2864

Browse files
committed
Layout.tsx migrated
1 parent 0bb725b commit 39d2864

File tree

1 file changed

+35
-41
lines changed

1 file changed

+35
-41
lines changed

src/components/Layout.tsx

Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import styled from "@emotion/styled"
66
import { IntlProvider } from "react-intl"
77
import { LocaleProvider } from "gatsby-theme-i18n"
88

9+
import { Flex } from "@chakra-ui/react"
10+
911
import { lightTheme, darkTheme } from "../theme"
1012

1113
import Footer from "./Footer"
@@ -30,40 +32,6 @@ import type { Context } from "../types"
3032

3133
import client from "../apollo"
3234

33-
const ContentContainer = styled.div`
34-
position: relative;
35-
margin: 0px auto;
36-
min-height: 100vh;
37-
display: flex;
38-
flex-flow: column;
39-
40-
@media (min-width: ${(props) => props.theme.breakpoints.l}) {
41-
max-width: ${(props) => props.theme.variables.maxPageWidth};
42-
}
43-
`
44-
45-
const MainContainer = styled.div`
46-
display: flex;
47-
@media (max-width: ${(props) => props.theme.breakpoints.l}) {
48-
flex-direction: column;
49-
}
50-
`
51-
52-
const MainContent = styled.div`
53-
display: flex;
54-
flex-direction: column;
55-
width: 100%;
56-
`
57-
58-
const Main = styled.main`
59-
display: flex;
60-
justify-content: space-around;
61-
align-items: flex-start;
62-
overflow: visible;
63-
width: 100%;
64-
flex-grow: 1;
65-
`
66-
6735
export interface IProps {
6836
children?: React.ReactNode
6937
data?: {
@@ -161,27 +129,53 @@ const Layout: React.FC<IProps> = ({
161129
isPageRightToLeft={isPageRightToLeft}
162130
originalPagePath={pageContext.originalPath!}
163131
/>
164-
<ContentContainer>
132+
133+
<Flex
134+
position="relative"
135+
margin="0px auto"
136+
minHeight="100vh"
137+
flexFlow="column"
138+
sx={{
139+
"@media": {
140+
minWidth: "1024px",
141+
maxWidth: "1504px",
142+
},
143+
}}
144+
>
165145
<ZenMode>
166146
<Nav path={path} />
167147
{shouldShowSideNav && <SideNavMobile path={path} />}
168148
</ZenMode>
169149
<SkipLinkAnchor id="main-content" />
170-
<MainContainer>
150+
<Flex
151+
sx={{
152+
"@media (max-width: 1024px": {
153+
flexDirection: "column",
154+
},
155+
}}
156+
>
171157
{shouldShowSideNav && (
172158
<ZenMode>
173159
<SideNav path={path} />
174160
</ZenMode>
175161
)}
176-
<MainContent>
177-
<Main>{children}</Main>
178-
</MainContent>
179-
</MainContainer>
162+
<Flex flexDirection="column" width="100%">
163+
<Flex
164+
justifyContent="space-around"
165+
alignItems="flex-start"
166+
overflow="visible"
167+
width="100%"
168+
flexGrow="1"
169+
>
170+
{children}
171+
</Flex>
172+
</Flex>
173+
</Flex>
180174
<ZenMode>
181175
<Footer />
182176
</ZenMode>
183177
<FeedbackWidget location={path} />
184-
</ContentContainer>
178+
</Flex>
185179
</ZenModeContext.Provider>
186180
</ThemeProvider>
187181
</ApolloProvider>

0 commit comments

Comments
 (0)