Skip to content

Commit

Permalink
feat: Support no layout SideNav
Browse files Browse the repository at this point in the history
  • Loading branch information
icaraps committed May 28, 2021
1 parent af25568 commit 6f13335
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions packages/gatsby-theme-aio/src/components/Layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ export default ({ children, pageContext, location }) => {
}

const frontMatter = pageContext?.frontmatter;
const hasLayout = pageContext?.frontmatter?.layout !== 'none';


const layoutId = nextId();
const sideNavId = nextId();

Expand Down Expand Up @@ -409,10 +408,9 @@ export default ({ children, pageContext, location }) => {
grid-template-rows: var(--spectrum-global-dimension-size-800);
grid-template-columns: ${hasSideNav ? `${SIDENAV_WIDTH} auto` : '0 auto'};
${hasLayout &&
`@media screen and (max-width: ${DESKTOP_SCREEN_WIDTH}) {
grid-template-columns: 0px auto;
}`}
@media screen and (max-width: ${DESKTOP_SCREEN_WIDTH}) {
grid-template-columns: 0px auto;
}
`}>
<div
css={css`
Expand Down Expand Up @@ -449,11 +447,10 @@ export default ({ children, pageContext, location }) => {
height: 100%;
background-color: var(--spectrum-global-color-gray-75);
${hasLayout &&
`@media screen and (max-width: ${DESKTOP_SCREEN_WIDTH}) {
transition: transform var(--spectrum-global-animation-duration-200) ease-in-out;
transform: translateX(${showSideNav ? '0' : '-100%'});
}`}
@media screen and (max-width: ${DESKTOP_SCREEN_WIDTH}) {
transition: transform var(--spectrum-global-animation-duration-200) ease-in-out;
transform: translateX(${showSideNav ? '0' : '-100%'});
}
`}>
{SideNav && (
<SideNav
Expand Down

0 comments on commit 6f13335

Please sign in to comment.