Skip to content

Commit

Permalink
chore: Adjust main layout and doc page for banner
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBaker committed Feb 9, 2023
1 parent 8a724ba commit c67e9e6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/layouts/MainLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ const MainLayout = ({ children, pageContext }) => {
<Layout.Main
css={css`
display: ${isMobileNavOpen ? 'none' : 'block'};
position: relative;
`}
>
{children}
Expand Down
26 changes: 26 additions & 0 deletions src/templates/docPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { css } from '@emotion/react';
import { graphql } from 'gatsby';
import { takeWhile } from 'lodash';
import PageTitle from '../components/PageTitle';
import DocPageBanner from '../components/DocPageBanner';
import MDXContainer from '../components/MDXContainer';
import {
ContributingGuidelines,
Expand Down Expand Up @@ -34,6 +35,8 @@ const splitTOCTitle = (title = '') => {
return [titleText.join(' '), slug];
};

const bannerHeight = '78px';

const BasicDoc = ({ data, location, pageContext }) => {
const { mdx } = data;
const {
Expand Down Expand Up @@ -68,7 +71,9 @@ const BasicDoc = ({ data, location, pageContext }) => {
translationType,
dataSource,
isTutorial,
signupBanner,
} = frontmatter;
console.log(signupBanner);

let { type } = frontmatter;

Expand All @@ -89,6 +94,14 @@ const BasicDoc = ({ data, location, pageContext }) => {
dataSource={dataSource}
disableSwiftype={disableSwiftype}
/>
{signupBanner && (
<DocPageBanner
height={bannerHeight}
text={signupBanner.text}
cta={signupBanner.cta}
url={signupBanner.url}
/>
)}
<div
css={css`
display: grid;
Expand All @@ -99,6 +112,14 @@ const BasicDoc = ({ data, location, pageContext }) => {
grid-template-columns: minmax(0, 1fr) 320px;
grid-column-gap: 2rem;
${signupBanner &&
css`
margin-top: ${bannerHeight};
@media screen and (max-width: 760px) {
margin-top: 0;
}
`}
@media screen and (max-width: 1240px) {
grid-template-areas:
'mt-disclaimer'
Expand Down Expand Up @@ -168,6 +189,11 @@ export const pageQuery = graphql`
isTutorial
translationType
dataSource
signupBanner {
cta
url
text
}
}
fields {
fileRelativePath
Expand Down

0 comments on commit c67e9e6

Please sign in to comment.