Initial commit
This commit is contained in:
commit
5a3bf52ebb
86 changed files with 2639 additions and 0 deletions
61
web/src/pages/archive.js
Normal file
61
web/src/pages/archive.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import React from 'react'
|
||||
import {graphql} from 'gatsby'
|
||||
import Container from '../components/container'
|
||||
import GraphQLErrorList from '../components/graphql-error-list'
|
||||
import ProjectPreviewGrid from '../components/project-preview-grid'
|
||||
import SEO from '../components/seo'
|
||||
import Layout from '../containers/layout'
|
||||
import {mapEdgesToNodes, filterOutDocsWithoutSlugs} from '../lib/helpers'
|
||||
|
||||
import {responsiveTitle1} from '../components/typography.module.css'
|
||||
|
||||
export const query = graphql`
|
||||
query ArchivePageQuery {
|
||||
projects: allSanityProject(
|
||||
limit: 12
|
||||
sort: {fields: [publishedAt], order: DESC}
|
||||
filter: {slug: {current: {ne: null}}, publishedAt: {ne: null}}
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
mainImage {
|
||||
asset {
|
||||
_id
|
||||
}
|
||||
alt
|
||||
}
|
||||
title
|
||||
_rawExcerpt
|
||||
slug {
|
||||
current
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const ArchivePage = props => {
|
||||
const {data, errors} = props
|
||||
if (errors) {
|
||||
return (
|
||||
<Layout>
|
||||
<GraphQLErrorList errors={errors} />
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
const projectNodes =
|
||||
data && data.projects && mapEdgesToNodes(data.projects).filter(filterOutDocsWithoutSlugs)
|
||||
return (
|
||||
<Layout>
|
||||
<SEO title='Archive' />
|
||||
<Container>
|
||||
<h1 className={responsiveTitle1}>Projects</h1>
|
||||
{projectNodes && projectNodes.length > 0 && <ProjectPreviewGrid nodes={projectNodes} />}
|
||||
</Container>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
export default ArchivePage
|
||||
Loading…
Add table
Add a link
Reference in a new issue