2020-05-22 14:38:19 +02:00
|
|
|
import React, { ReactElement } from 'react'
|
2018-08-30 22:50:09 +02:00
|
|
|
import { Link } from 'gatsby'
|
2018-07-19 23:04:41 +02:00
|
|
|
import slugify from 'slugify'
|
2023-01-26 19:36:45 +01:00
|
|
|
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
|
2023-01-29 22:58:19 +01:00
|
|
|
import Tag from '../../atoms/Tag'
|
2021-03-01 00:03:39 +01:00
|
|
|
import PostDate from '../../molecules/PostDate'
|
2023-01-29 22:58:19 +01:00
|
|
|
import * as styles from './Meta.module.css'
|
2018-07-19 02:22:01 +02:00
|
|
|
|
2022-11-11 03:31:54 +01:00
|
|
|
export default function PostMeta({
|
|
|
|
post
|
|
|
|
}: {
|
|
|
|
post: Queries.BlogPostBySlugQuery['post']
|
|
|
|
}): ReactElement {
|
2019-10-02 15:32:01 +02:00
|
|
|
const siteMeta = useSiteMetadata()
|
2021-02-28 04:50:05 +01:00
|
|
|
const { author, updated, tags } = post.frontmatter
|
|
|
|
const { date, type } = post.fields
|
2018-07-19 02:22:01 +02:00
|
|
|
|
|
|
|
return (
|
2022-11-11 03:31:54 +01:00
|
|
|
<footer className={styles.entryMeta}>
|
|
|
|
<div className={styles.byline}>
|
|
|
|
<span className={styles.by}>by</span>
|
2019-10-02 15:32:01 +02:00
|
|
|
<a className="fn" rel="author" href={siteMeta.author.uri}>
|
|
|
|
{author || siteMeta.author.name}
|
2018-07-19 02:22:01 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
2021-03-01 00:03:39 +01:00
|
|
|
<PostDate date={date} updated={updated} />
|
2018-07-19 02:22:01 +02:00
|
|
|
|
2018-11-08 17:43:40 +01:00
|
|
|
{type && type === 'photo' && (
|
2022-11-11 03:31:54 +01:00
|
|
|
<div className={styles.type}>
|
2018-11-08 17:43:40 +01:00
|
|
|
<Link to={`/${slugify(type)}s/`}>{type}s</Link>
|
|
|
|
</div>
|
|
|
|
)}
|
2018-07-19 02:22:01 +02:00
|
|
|
|
|
|
|
{tags && (
|
2022-11-11 03:31:54 +01:00
|
|
|
<div className={styles.tags}>
|
|
|
|
{tags.map((tag) => {
|
2020-07-19 13:31:27 +02:00
|
|
|
const url = `/archive/${slugify(tag)}/`
|
2022-05-12 01:00:19 +02:00
|
|
|
return <Tag key={tag} name={tag} url={url} />
|
2018-09-13 21:51:13 +02:00
|
|
|
})}
|
2018-07-19 02:22:01 +02:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</footer>
|
|
|
|
)
|
|
|
|
}
|