Skip to content

Commit 992d2f4

Browse files
authored
Merge pull request #8811 from armgp/layout
Layout.tsx migrated
2 parents 6836f69 + 0fd63cc commit 992d2f4

File tree

1 file changed

+28
-41
lines changed

1 file changed

+28
-41
lines changed

src/components/Layout.tsx

Lines changed: 28 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,46 @@ 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+
maxW={{
139+
lg: lightTheme.variables.maxPageWidth
140+
}}
141+
>
165142
<ZenMode>
166143
<Nav path={path} />
167144
{shouldShowSideNav && <SideNavMobile path={path} />}
168145
</ZenMode>
169146
<SkipLinkAnchor id="main-content" />
170-
<MainContainer>
147+
<Flex
148+
flexDirection={{ base: 'column', lg: 'row' }}
149+
>
171150
{shouldShowSideNav && (
172151
<ZenMode>
173152
<SideNav path={path} />
174153
</ZenMode>
175154
)}
176-
<MainContent>
177-
<Main>{children}</Main>
178-
</MainContent>
179-
</MainContainer>
155+
<Flex flexDirection="column" width="100%">
156+
<Flex
157+
justifyContent="space-around"
158+
alignItems="flex-start"
159+
overflow="visible"
160+
width="100%"
161+
flexGrow="1"
162+
>
163+
{children}
164+
</Flex>
165+
</Flex>
166+
</Flex>
180167
<ZenMode>
181168
<Footer />
182169
</ZenMode>
183170
<FeedbackWidget location={path} />
184-
</ContentContainer>
171+
</Flex>
185172
</ZenModeContext.Provider>
186173
</ThemeProvider>
187174
</ApolloProvider>

0 commit comments

Comments
 (0)