import React, { Fragment } from 'react' import PropTypes from 'prop-types' import { Link, graphql } from 'gatsby' import Layout from '../components/Layout' import Image from '../components/atoms/Image' import PostTitle from '../components/atoms/PostTitle' import PostLead from '../components/atoms/PostLead' import PostContent from '../components/atoms/PostContent' import PostMore from '../components/atoms/PostMore' import PostLinkActions from '../components/atoms/PostLinkActions' import postStyles from '../templates/Post.module.scss' import styles from './index.module.scss' const IndexPage = ({ data, location }) => { const edges = data.allMarkdownRemark.edges const Posts = edges.map(({ node }) => { const { type, linkurl, title, image } = node.frontmatter const { slug } = node.fields return (
{image && (
{title}
)} {type === 'post' && Continue Reading} {type === 'link' && ( )}
) }) return {Posts} } IndexPage.propTypes = { data: PropTypes.object.isRequired, location: PropTypes.object.isRequired } export default IndexPage export const indexQuery = graphql` query { allMarkdownRemark(sort: { order: DESC, fields: [fields___date] }) { edges { node { id html excerpt(pruneLength: 250) frontmatter { title type linkurl image { childImageSharp { ...ImageFluid } } } fields { slug date(formatString: "MMMM DD, YYYY") } } } } } `