Skip to content

Commit

Permalink
Allowed unpublishing of intro information in contentful (#390)
Browse files Browse the repository at this point in the history
* commented the intro information so it can be reused next year

* feat: add possibility to unpublish intro information in contentful

---------

Co-authored-by: Job Vonk <[email protected]>
  • Loading branch information
SamStaijen and stickyPiston authored Nov 20, 2024
1 parent 51adc6a commit 7e1a4a6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
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

0 comments on commit 7e1a4a6

Please sign in to comment.