Skip to content

Commit

Permalink
Merge pull request #10736 from ethereum/fix-learn-hub-layout
Browse files Browse the repository at this point in the history
Fix learn hub layout
  • Loading branch information
pettinarip authored Jul 20, 2023
2 parents 0f93173 + 9ee1b2e commit 6393fb7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 33 deletions.
52 changes: 19 additions & 33 deletions src/pages/learn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import {
Heading,
HeadingProps,
ListItem,
Show,
Text,
UnorderedList,
useTheme,
useToken,
} from "@chakra-ui/react"
import { graphql, PageProps } from "gatsby"
import { GatsbyImage } from "gatsby-plugin-image"
Expand All @@ -28,6 +29,11 @@ import PageHero from "../../components/PageHero"
import PageMetadata from "../../components/PageMetadata"
import Translation from "../../components/Translation"
import UpgradeTableOfContents from "../../components/UpgradeTableOfContents"
import {
ContentContainer,
InfoColumn,
InfoTitle,
} from "../../templates/use-cases"

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

const LearnPage = ({ data }: PageProps<Queries.LearnPageQuery, Context>) => {
const theme = useTheme()
const { t } = useTranslation()
const { language } = useI18next()
const isRightToLeft = isLangRightToLeft(language as Lang)
const lgBp = useToken("breakpoints", "lg")

const tocItems = [
{
Expand Down Expand Up @@ -188,36 +194,16 @@ const LearnPage = ({ data }: PageProps<Queries.LearnPageQuery, Context>) => {
pt={{ lg: 16 }}
dir={isRightToLeft ? "rtl" : "ltr"}
>
<Box
as="aside"
display={{ base: "none", lg: "flex" }}
flexDirection="column"
position="sticky"
top="6.25rem" // account for navbar
h="calc(100vh - 80px)"
flex="0 1 330px"
mx={8}
>
<Heading
lineHeight={1.4}
fontSize={{ base: "2.5rem", lg: "5xl" }}
fontWeight="bold"
textAlign={{ base: "left", lg: "right" }}
mt={0}
display={{ base: "none", lg: "block" }}
>
<Translation id="toc-learn-hub" />
</Heading>
<UpgradeTableOfContents items={tocItems} />
</Box>

<Box
as="article"
flex={`1 1 ${theme.breakpoints.l}`}
pb={8}
px={8}
id="content"
>
<Show above={lgBp}>
<InfoColumn>
<InfoTitle>
<Translation id="toc-learn-hub" />
</InfoTitle>
<UpgradeTableOfContents items={tocItems} />
</InfoColumn>
</Show>

<ContentContainer id="content">
<Section>
<H2 mt={{ lg: 0 }} id={tocItems[0].id}>
{tocItems[0].title}
Expand Down Expand Up @@ -864,7 +850,7 @@ const LearnPage = ({ data }: PageProps<Queries.LearnPageQuery, Context>) => {
</Section>

<FeedbackCard />
</Box>
</ContentContainer>
</Flex>
</Box>
)
Expand Down
1 change: 1 addition & 0 deletions src/templates/use-cases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export const Page = (props: FlexProps) => (

export const InfoColumn = (props: ChildOnlyProp) => (
<Flex
as="aside"
flexDirection="column"
flex="0 1 400px"
ml={8}
Expand Down

0 comments on commit 6393fb7

Please sign in to comment.