1
0
Fork 0
blog/src/pages/index.tsx

91 lines
2.1 KiB
TypeScript
Raw Normal View History

2020-07-08 01:31:03 +02:00
import React, { ReactElement } from 'react'
2020-07-11 10:29:42 +02:00
import { graphql, Link, PageProps } from 'gatsby'
2020-07-08 01:31:03 +02:00
import Page from '../components/templates/Page'
import { Post } from '../@types/Post'
import { Image } from '../components/atoms/Image'
import styles from './index.module.scss'
import Featured from '../components/molecules/Featured'
const page = {
frontmatter: {
title: 'home',
description: 'Blog of designer & developer Matthias Kretschmann.'
}
}
2020-07-11 10:29:42 +02:00
export default function Home(props: PageProps): ReactElement {
2020-07-08 01:31:03 +02:00
return (
2020-07-11 10:29:42 +02:00
<Page title={page.frontmatter.title} post={page} section={styles.home}>
2020-07-08 01:31:03 +02:00
<Featured />
Latest Posts & Links
<br />
Latest Photos
</Page>
)
}
export const homeQuery = graphql`
query {
latestPosts: allMarkdownRemark(
filter: { frontmatter: { type: { eq: "post" } } }
sort: { order: DESC, fields: [fields___date] }
limit: 5
) {
edges {
node {
frontmatter {
title
type
image {
childImageSharp {
fluid(
maxWidth: 400
maxHeight: 400
quality: 85
cropFocus: CENTER
) {
...GatsbyImageSharpFluid_withWebp
}
}
}
}
fields {
slug
}
}
}
}
latestPhotos: allMarkdownRemark(
filter: { frontmatter: { type: { eq: "photo" } } }
sort: { order: DESC, fields: [fields___date] }
limit: 10
) {
edges {
node {
id
frontmatter {
title
type
image {
childImageSharp {
fluid(
maxWidth: 400
maxHeight: 400
quality: 85
cropFocus: CENTER
) {
...GatsbyImageSharpFluid_withWebp
}
}
}
}
fields {
slug
}
}
}
}
}
`