Skip to content

Commit

Permalink
feat: move the content area into a grid
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jul 30, 2020
1 parent 1a8eb4d commit 48da4d9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 38 deletions.
7 changes: 4 additions & 3 deletions src/components/RelatedContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import { Button, ExternalLink, Icon } from '@newrelic/gatsby-theme-newrelic';
import { PageContext } from './PageContext';

const RelatedContent = ({ className, page }) => {
const {
fields: { gitAuthorTime },
} = page;
const { site } = useStaticQuery(graphql`
query {
site {
Expand All @@ -20,6 +17,10 @@ const RelatedContent = ({ className, page }) => {
`);
const { fileRelativePath } = useContext(PageContext);

const {
fields: { gitAuthorTime },
} = page;

const {
siteMetadata: { repository },
} = site;
Expand Down
83 changes: 48 additions & 35 deletions src/templates/GuideTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,56 +17,69 @@ const GuideTemplate = ({ data }) => {
return (
<>
<SEO title={title} description={description} />
<div
css={css`
border-bottom: 1px solid var(--divider-color);
display: flex;
margin-bottom: 2rem;
align-items: center;
justify-content: space-between;
@media screen and (max-width: 1080px) {
flex-direction: column;
align-items: flex-start;
}
`}
>
<PageTitle>{title}</PageTitle>
{duration && (
<div
css={css`
display: flex;
align-items: center;
color: var(--secondary-text-color);
white-space: nowrap;
`}
>
<FeatherIcon
name="clock"
css={css`
margin-right: 0.25rem;
`}
/>
{duration}
</div>
)}
</div>
<div
css={css`
display: grid;
grid-template-areas:
'page-title page-title'
'content related-content';
grid-template-columns: minmax(0, 1fr) auto;
grid-gap: 2rem;
@media (max-width: 1240px) {
grid-template-areas:
'page-title'
'content';
grid-template-columns: minmax(0, 1fr);
grid-gap: 0;
}
`}
>
<MDXContainer>{body}</MDXContainer>
<div
css={css`
grid-area: page-title;
border-bottom: 1px solid var(--divider-color);
display: flex;
align-items: center;
justify-content: space-between;
@media screen and (max-width: 1080px) {
flex-direction: column;
align-items: flex-start;
}
`}
>
<PageTitle>{title}</PageTitle>
{duration && (
<div
css={css`
display: flex;
align-items: center;
color: var(--secondary-text-color);
white-space: nowrap;
`}
>
<FeatherIcon
name="clock"
css={css`
margin-right: 0.25rem;
`}
/>
{duration}
</div>
)}
</div>
<MDXContainer
css={css`
grid-area: content;
`}
>
{body}
</MDXContainer>
<RelatedContent
page={mdx}
css={css`
grid-area: related-content;
position: sticky;
top: calc(var(--global-header-height) + 2rem);
align-self: start;
Expand Down

0 comments on commit 48da4d9

Please sign in to comment.