Skip to content

Commit

Permalink
Adds 'eth2' to gatsby template list [Fixes #1768]
Browse files Browse the repository at this point in the history
Adds 'eth2' slug to gatsby template check to properly associate any eth2 markdown content files to this template. Adjusted necessary component imports and fixed one small markdown bug (added missing key to a section header).
Also made "Summary Box" in 'eth2 template' render conditionally, only if data is available.
  • Loading branch information
wackerow committed Nov 11, 2020
1 parent 4892205 commit e89860f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 2 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
template = `tutorial`
} else if (slug.includes(`/docs/`)) {
template = `docs`
} else if (slug.includes(`/eth2/`)) {
template = `eth2`
}

createPage({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ title="How can I get more involved in Eth2?">
</ul>
</ExpandableCard>

## More on Staking and Eth2
## More on Staking and Eth2 {#more-on-staking-and-eth2}

<CardContainer>
<Card title="Staking" description="Learn more about staking. Where you can do it, what you need, and the potential risks and rewards." emoji=":money_bag:"><ButtonLink to="/eth2/staking/">More on staking</ButtonLink></Card>
Expand Down
26 changes: 18 additions & 8 deletions src/templates/eth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import Translation from "../components/Translation"
import TranslationsInProgress from "../components/TranslationsInProgress"
import Warning from "../components/Warning"
import SectionNav from "../components/SectionNav"
import ExpandableCard from "../components/ExpandableCard"
import { CardContainer } from "../components/SharedStyledComponents"
import { getLocaleTimestamp } from "../utils/time"
import { isLangRightToLeft } from "../utils/translations"
import {
Expand Down Expand Up @@ -192,6 +194,8 @@ const components = {
Eth2BeaconChainActions,
Eth2ShardChainsList,
Eth2DockingList,
ExpandableCard,
CardContainer,
}

const InfoColumn = styled.aside`
Expand Down Expand Up @@ -319,14 +323,20 @@ const Eth2Page = ({ data: { mdx } }) => {
</InfoColumn>
<ContentContainer>
<DesktopBreadcrumbs slug={mdx.fields.slug} startDepth={1} />
<SummaryBox>
<Label>Summary</Label>
<ul>
<SummaryPoint>{mdx.frontmatter.summary1}</SummaryPoint>
<SummaryPoint>{mdx.frontmatter.summary2}</SummaryPoint>
<SummaryPoint>{mdx.frontmatter.summary3}</SummaryPoint>
</ul>
</SummaryBox>
{mdx.frontmatter.summary1 && (
<SummaryBox>
<Label>Summary</Label>
<ul>
<SummaryPoint>{mdx.frontmatter.summary1}</SummaryPoint>
{mdx.frontmatter.summary2 && (
<SummaryPoint>{mdx.frontmatter.summary2}</SummaryPoint>
)}
{mdx.frontmatter.summary3 && (
<SummaryPoint>{mdx.frontmatter.summary3}</SummaryPoint>
)}
</ul>
</SummaryBox>
)}
<MDXProvider components={components}>
<MDXRenderer>{mdx.body}</MDXRenderer>
</MDXProvider>
Expand Down

0 comments on commit e89860f

Please sign in to comment.