Implement Featured logic, maybe
This commit is contained in:
parent
5531ed630b
commit
58f247da27
26
src/lib/cms/queries/press.js
Normal file
26
src/lib/cms/queries/press.js
Normal file
@ -0,0 +1,26 @@
|
||||
const PressFeatured = {
|
||||
query: `
|
||||
{
|
||||
allBlogPosts(filter: { featured: { eq: true }}, orderBy: date_DESC) {
|
||||
featured
|
||||
date
|
||||
author {
|
||||
name
|
||||
}
|
||||
category {
|
||||
title
|
||||
}
|
||||
image {
|
||||
url
|
||||
}
|
||||
slug
|
||||
title
|
||||
content {
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export { PressFeatured }
|
||||
@ -10,15 +10,9 @@ import Related from '~/components/sections/about/related'
|
||||
import Hero from '~/components/sections/newsroom/hero'
|
||||
import Media from '~/components/sections/newsroom/media'
|
||||
import Press from '~/components/sections/newsroom/press'
|
||||
import { PressFeatured } from '~/lib/cms/queries/press'
|
||||
|
||||
// import {
|
||||
// CareersHero,
|
||||
// CareersPositions,
|
||||
// CareersPositionsSection,
|
||||
// CareersValues,
|
||||
// CareersWhy
|
||||
// } from '~/lib/cms/queries/careers'
|
||||
// import { request } from '../lib/datocms'
|
||||
import { request } from '../lib/datocms'
|
||||
|
||||
export const getStaticProps = async () => {
|
||||
const [allBlogPosts, categories] = await Promise.all([
|
||||
@ -28,18 +22,15 @@ export const getStaticProps = async () => {
|
||||
|
||||
const heroBlogPost = allBlogPosts.data[0]
|
||||
|
||||
// const [latestData] = await Promise.all([request(HomeLatest)])
|
||||
const [pressData] = await Promise.all([request(PressFeatured)])
|
||||
|
||||
return {
|
||||
props: {
|
||||
// heroData: heroData?.careersPage,
|
||||
// valuesData: valuesData?.careersPage,
|
||||
// positionsSectData: positionsSectData?.careersPage,
|
||||
// whyData: whyData?.careersPage,
|
||||
// positionsData: positionsData?.allPositions,
|
||||
pressData: pressData?.allBlogPosts?.slice(0, 3),
|
||||
initialBlogPosts: {
|
||||
pagination: allBlogPosts.pagination,
|
||||
data: allBlogPosts.data.slice(0, 3)
|
||||
pagination: allBlogPosts?.pagination,
|
||||
data: allBlogPosts?.data.slice(0, 3)
|
||||
},
|
||||
categories,
|
||||
page:
|
||||
@ -52,17 +43,14 @@ export const getStaticProps = async () => {
|
||||
}
|
||||
|
||||
const Newsroom = ({
|
||||
initialBlogPosts
|
||||
initialBlogPosts,
|
||||
pressData
|
||||
}: InferGetStaticPropsType<typeof getStaticProps>) => {
|
||||
return (
|
||||
<PageLayout>
|
||||
<Meta />
|
||||
<Hero />
|
||||
<Related
|
||||
data={initialBlogPosts?.data}
|
||||
isFeatured={true}
|
||||
reduced={false}
|
||||
/>
|
||||
<Related data={pressData} isFeatured={true} reduced={false} />
|
||||
<Press blogData={initialBlogPosts?.data} />
|
||||
<Media />
|
||||
<Related data={initialBlogPosts?.data} reduced={true} />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user