Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commented the intro information so it can be reused next year #390

Open
wants to merge 10 commits into
base: development
Choose a base branch
from
18 changes: 10 additions & 8 deletions src/components/layout/GridDryQueries.jsx
Original file line number Diff line number Diff line change
@@ -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;
}
Expand All @@ -23,9 +23,11 @@ const IndexWrapper = styled.div`
.mainPartner {
grid-area: mainPartner;
}
.introInformation {
grid-area: introInformation;
}
${hasIntroInformation
? `.introInformation {
grid-area: introInformation;
}`
: ''}

.banner {
display: grid;
Expand All @@ -41,7 +43,7 @@ const IndexWrapper = styled.div`
grid-template-areas:
'logo'
'banner'
'introInformation'
${hasIntroInformation ? `'introInformation'` : ''}
'news'
'news'
'drinks'
Expand All @@ -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';
Expand All @@ -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'
Expand All @@ -98,4 +100,4 @@ const IndexWrapper = styled.div`
}
`;

export default IndexWrapper;
export default IndexWrapperFactory;
18 changes: 14 additions & 4 deletions src/static-pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 (
<Layout title="Sticky">
<IndexWrapper
Expand All @@ -35,9 +38,11 @@ const Index = ({ data }) => {
<div className="news">
<News itemsPerPage="5" />
</div>
<div className="introInformation">
<IntroInformation />
</div>
{hasIntroInformation && (
<div className="introInformation">
<IntroInformation />
</div>
)}
<div className="drinks">
<Drinks />
</div>
Expand All @@ -62,6 +67,11 @@ export const indexQuery = graphql`
contentfulBoard(current: { eq: true }) {
color
}
allContentfulIntroInformation {
nodes {
id
}
}
allContentfulPartner {
edges {
node {
Expand Down
Loading