diff --git a/src/components/layout/GridDryQueries.jsx b/src/components/layout/GridDryQueries.jsx index eb756b7..2744d6b 100644 --- a/src/components/layout/GridDryQueries.jsx +++ b/src/components/layout/GridDryQueries.jsx @@ -1,7 +1,7 @@ import { device } from '../../data/Devices'; import styled from 'styled-components'; -const IndexWrapper = styled.div` +const IndexWrapperFactory = hasIntroInformation => styled.div` .logo { grid-area: logo; } @@ -23,9 +23,11 @@ const IndexWrapper = styled.div` .mainPartner { grid-area: mainPartner; } - .introInformation { - grid-area: introInformation; - } + ${hasIntroInformation + ? `.introInformation { + grid-area: introInformation; + }` + : ''} .banner { display: grid; @@ -41,7 +43,7 @@ const IndexWrapper = styled.div` grid-template-areas: 'logo' 'banner' - 'introInformation' + ${hasIntroInformation ? `'introInformation'` : ''} 'news' 'news' 'drinks' @@ -68,7 +70,7 @@ const IndexWrapper = styled.div` grid-template-columns: 1fr 1fr; grid-template-areas: 'banner banner' - 'introInformation introInformation' + ${hasIntroInformation ? `'introInformation introInformation'` : ''} 'news news' 'drinks mainPartner' 'jobs activity'; @@ -85,7 +87,7 @@ const IndexWrapper = styled.div` grid-template-columns: 3fr 1fr; grid-template-areas: 'banner banner' - 'news introInformation' + ${hasIntroInformation ? `'news introInformation'` : ''} 'news drinks' 'news mainPartner' 'news jobs' @@ -98,4 +100,4 @@ const IndexWrapper = styled.div` } `; -export default IndexWrapper; +export default IndexWrapperFactory; diff --git a/src/static-pages/index.jsx b/src/static-pages/index.jsx index fc4d8c7..166ac33 100644 --- a/src/static-pages/index.jsx +++ b/src/static-pages/index.jsx @@ -8,7 +8,7 @@ import News from '$/components/News'; import Drinks from '$/components/Drinks'; import MainPartnerIndex from '$/components/mainpartner/Card'; import MainPartnerBanner from '$/components/mainpartner/Banner'; -import IndexWrapper from '$/components/layout/GridDryQueries'; +import IndexWrapperFactory from '$/components/layout/GridDryQueries'; import FeaturedJobWidget from '$/components/jobs/FeaturedJobWidget'; import ActivityWidget from '$/components/activities/ActivityWidget'; import IntroInformation from '$/components/IntroInformation'; @@ -19,6 +19,9 @@ const Index = ({ data }) => { const mainPartner = data.allContentfulPartner.edges.filter( edge => edge.node.isMainPartner )[0].node; + const hasIntroInformation = !!data.allContentfulIntroInformation.nodes.length; + const IndexWrapper = IndexWrapperFactory(hasIntroInformation); + return ( {
-
- -
+ {hasIntroInformation && ( +
+ +
+ )}
@@ -62,6 +67,11 @@ export const indexQuery = graphql` contentfulBoard(current: { eq: true }) { color } + allContentfulIntroInformation { + nodes { + id + } + } allContentfulPartner { edges { node {