import React, { ReactElement } from 'react' import { Helmet } from 'react-helmet' import { graphql } from 'gatsby' import Exif from '../../atoms/Exif' import SEO from '../../atoms/SEO' import RelatedPosts from '../../molecules/RelatedPosts' import PostTitle from './Title' import PostLead from './Lead' import PostContent from './Content' import PostActions from './Actions' import PostLinkActions from './LinkActions' import PostMeta from './Meta' import PrevNext from './PrevNext' import * as styles from './index.module.css' import { Image } from '../../atoms/Image' export default function Post({ data, pageContext: { next, prev } }: { data: Queries.BlogPostBySlugQuery pageContext: { next: { title: string; slug: string } prev: { title: string; slug: string } } }): ReactElement { const { post } = data const { title, image, linkurl, style, tags, updated } = post.frontmatter const { slug, githubLink, date, type } = post.fields return ( <> {style && }
{type === 'article' && } {type === 'photo' && } {image && ( {title} )} {type === 'photo' ? ( image?.fields && ( ) ) : ( )} {type === 'link' && }
) } export const pageQuery = graphql` query BlogPostBySlug($slug: String!) { post: markdownRemark(fields: { slug: { eq: $slug } }) { html excerpt frontmatter { title image { childImageSharp { ...ImageFluid } fields { exif { formatted { iso model fstop shutterspeed focalLength lensModel exposure gps { latitude longitude } } } } } toc author updated tags linkurl style { publicURL } changelog } fields { type slug date githubLink } rawMarkdownBody tableOfContents(maxDepth: 3) } } `