1
0
Fork 0
blog/src/templates/Post/PrevNext.tsx

40 lines
853 B
TypeScript
Raw Normal View History

2019-11-11 01:00:26 +01:00
import React from 'react'
import { Link } from 'gatsby'
2019-11-15 22:10:53 +01:00
import Icon from '../../components/atoms/Icon'
2019-11-11 01:00:26 +01:00
import styles from './PrevNext.module.scss'
interface Node {
title: string
slug: string
}
interface PrevNextProps {
prev: Node
next: Node
}
const PrevNext = ({ prev, next }: PrevNextProps) => (
<nav className={styles.prevnext}>
<div>
{prev && (
<Link to={prev.slug}>
2019-11-15 22:10:53 +01:00
<Icon name="ChevronLeft" />
<p className={styles.label}>Newer</p>
2019-11-11 01:00:26 +01:00
<h3 className={styles.title}>{prev.title}</h3>
</Link>
)}
</div>
<div>
{next && (
<Link to={next.slug}>
2019-11-15 22:10:53 +01:00
<p className={styles.label}>Older</p>
2019-11-11 01:00:26 +01:00
<h3 className={styles.title}>{next.title}</h3>
2019-11-15 22:10:53 +01:00
<Icon name="ChevronRight" />
2019-11-11 01:00:26 +01:00
</Link>
)}
</div>
</nav>
)
export default PrevNext