Skip to content

Commit 9ee1b2e

Browse files
committed
reuse same layout components from use-cases template
1 parent 0f93173 commit 9ee1b2e

File tree

2 files changed

+20
-33
lines changed

2 files changed

+20
-33
lines changed

src/pages/learn/index.tsx

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import {
88
Heading,
99
HeadingProps,
1010
ListItem,
11+
Show,
1112
Text,
1213
UnorderedList,
13-
useTheme,
14+
useToken,
1415
} from "@chakra-ui/react"
1516
import { graphql, PageProps } from "gatsby"
1617
import { GatsbyImage } from "gatsby-plugin-image"
@@ -28,6 +29,11 @@ import PageHero from "../../components/PageHero"
2829
import PageMetadata from "../../components/PageMetadata"
2930
import Translation from "../../components/Translation"
3031
import UpgradeTableOfContents from "../../components/UpgradeTableOfContents"
32+
import {
33+
ContentContainer,
34+
InfoColumn,
35+
InfoTitle,
36+
} from "../../templates/use-cases"
3137

3238
// Utils
3339
import { Lang } from "../../utils/languages"
@@ -114,10 +120,10 @@ const H3 = ({ children, ...props }: HeadingProps) => {
114120
}
115121

116122
const LearnPage = ({ data }: PageProps<Queries.LearnPageQuery, Context>) => {
117-
const theme = useTheme()
118123
const { t } = useTranslation()
119124
const { language } = useI18next()
120125
const isRightToLeft = isLangRightToLeft(language as Lang)
126+
const lgBp = useToken("breakpoints", "lg")
121127

122128
const tocItems = [
123129
{
@@ -188,36 +194,16 @@ const LearnPage = ({ data }: PageProps<Queries.LearnPageQuery, Context>) => {
188194
pt={{ lg: 16 }}
189195
dir={isRightToLeft ? "rtl" : "ltr"}
190196
>
191-
<Box
192-
as="aside"
193-
display={{ base: "none", lg: "flex" }}
194-
flexDirection="column"
195-
position="sticky"
196-
top="6.25rem" // account for navbar
197-
h="calc(100vh - 80px)"
198-
flex="0 1 330px"
199-
mx={8}
200-
>
201-
<Heading
202-
lineHeight={1.4}
203-
fontSize={{ base: "2.5rem", lg: "5xl" }}
204-
fontWeight="bold"
205-
textAlign={{ base: "left", lg: "right" }}
206-
mt={0}
207-
display={{ base: "none", lg: "block" }}
208-
>
209-
<Translation id="toc-learn-hub" />
210-
</Heading>
211-
<UpgradeTableOfContents items={tocItems} />
212-
</Box>
213-
214-
<Box
215-
as="article"
216-
flex={`1 1 ${theme.breakpoints.l}`}
217-
pb={8}
218-
px={8}
219-
id="content"
220-
>
197+
<Show above={lgBp}>
198+
<InfoColumn>
199+
<InfoTitle>
200+
<Translation id="toc-learn-hub" />
201+
</InfoTitle>
202+
<UpgradeTableOfContents items={tocItems} />
203+
</InfoColumn>
204+
</Show>
205+
206+
<ContentContainer id="content">
221207
<Section>
222208
<H2 mt={{ lg: 0 }} id={tocItems[0].id}>
223209
{tocItems[0].title}
@@ -864,7 +850,7 @@ const LearnPage = ({ data }: PageProps<Queries.LearnPageQuery, Context>) => {
864850
</Section>
865851

866852
<FeedbackCard />
867-
</Box>
853+
</ContentContainer>
868854
</Flex>
869855
</Box>
870856
)

src/templates/use-cases.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ export const Page = (props: FlexProps) => (
207207

208208
export const InfoColumn = (props: ChildOnlyProp) => (
209209
<Flex
210+
as="aside"
210211
flexDirection="column"
211212
flex="0 1 400px"
212213
ml={8}

0 commit comments

Comments
 (0)