Skip to content

Commit

Permalink
Merge branch '170-refactor-switch-contacts-to-use-a-slug' into 167-re…
Browse files Browse the repository at this point in the history
…gression-add-created-date-field-to-projects-netlify-and-check-that-it-works-with-sorting
  • Loading branch information
hollandjg authored Oct 27, 2022
2 parents f1ebfba + c4a3d8d commit 0df597b
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 20 deletions.
26 changes: 26 additions & 0 deletions packages/example-site/content/project/ongoing-project2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"slug": "ongoing-project-2",
"question": "Hello world (from json)?",
"mainContact": "first-contact",
"projectTeam": [
"first-contact",
"second-contact"
],
"agency": "example agency",
"deliverable": "example deliverable",
"description": "example description",
"emailContent": "example emailContent",
"endDate": "2016-12-15",
"expertise": "example expertise",
"fundingInfo": "example fundingInfo",
"keyDates": "example keyDates",
"lastModified": "example lastModified",
"opportunityCloses": "2022-10-28",
"purpose": "example purpose",
"requirement": "example requirement",
"startDate": "2022-06-17",
"status": "ongoing",
"statusOfData": "example statusOfData",
"summary": "example summary",
"topics": ["example topics"]
}
26 changes: 26 additions & 0 deletions packages/example-site/content/project/open-project-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"slug": "open-project-2",
"question": "Hello world (from json)?",
"mainContact": "the-boss",
"projectTeam": [
"first-contact",
"second-contact"
],
"agency": "example agency",
"deliverable": "example deliverable",
"description": "example description",
"emailContent": "example emailContent",
"endDate": "2016-12-15",
"expertise": "example expertise",
"fundingInfo": "example fundingInfo",
"keyDates": "example keyDates",
"lastModified": "example lastModified",
"opportunityCloses": "2022-10-28",
"purpose": "example purpose",
"requirement": "example requirement",
"startDate": "2022-06-17",
"status": "open",
"statusOfData": "example statusOfData",
"summary": "example summary",
"topics": ["example topics"]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 0 additions & 20 deletions packages/example-site/src/pages/index.js

This file was deleted.

68 changes: 68 additions & 0 deletions packages/gatsby-theme-project-portal/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React from "react"
import { graphql } from "gatsby"
import { CardProps } from "../components"
import { useStaticText } from "../hooks"
import { ProjectPageLayout } from "../layouts/ProjectPageLayout"

export interface OpenProjectProps {
data: {
allProject: {
nodes: CardProps[]
}
bgImage: {
childImageSharp: {
resize: {
src: string
}
}
}
}
}

export default ({ data: { allProject, bgImage } }: OpenProjectProps) => {
const { open } = useStaticText()

return (
<ProjectPageLayout
allProject={allProject}
bgImage={bgImage}
title={open.title}
lede={open.lede}
pageName={open.pageName}
sortOptions={["created", "opportunityCloses"]}
/>
)
}
export const query = graphql`
query ProjectPageQuery {
allProject(filter: { status: { eq: "open" } }) {
nodes {
question
slug
status
summary
deliverable
expertise
keyDates
endDate
agency
topics
statusOfData
priorResearch
fundingInfo
lastModified
}
}
bgImage: file(
name: { eq: "open" }
extension: { in: ["png", "jpg", "jpeg"] }
sourceInstanceName: { eq: "themeImages" }
) {
childImageSharp {
resize(width: 1536) {
src
}
}
}
}
`
68 changes: 68 additions & 0 deletions packages/gatsby-theme-project-portal/src/pages/ongoing.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React from "react"
import { graphql } from "gatsby"
import { CardProps } from "../components"
import { useStaticText } from "../hooks"
import { ProjectPageLayout } from "../layouts/ProjectPageLayout"

export interface OngoingProjectProps {
data: {
allProject: {
nodes: CardProps[]
}
bgImage: {
childImageSharp: {
resize: {
src: string
}
}
}
}
}

export default ({ data: { allProject, bgImage } }: OngoingProjectProps) => {
const { ongoing } = useStaticText()

return (
<ProjectPageLayout
allProject={allProject}
bgImage={bgImage}
title={ongoing.title}
lede={ongoing.lede}
pageName={ongoing.pageName}
sortOptions={["startDate", "created"]}
/>
)
}
export const query = graphql`
query ProjectPageQuery {
allProject(filter: { status: { eq: "ongoing" } }) {
nodes {
question
slug
status
summary
deliverable
expertise
keyDates
endDate
agency
topics
statusOfData
priorResearch
fundingInfo
lastModified
}
}
bgImage: file(
name: { eq: "ongoing" }
extension: { in: ["png", "jpg", "jpeg"] }
sourceInstanceName: { eq: "themeImages" }
) {
childImageSharp {
resize(width: 1536) {
src
}
}
}
}
`

0 comments on commit 0df597b

Please sign in to comment.