|
| 1 | +/* eslint-disable camelcase */ |
1 | 2 | import {useEffect} from 'react'
|
2 | 3 | import PropTypes from 'prop-types'
|
3 |
| -import Link from 'next/link' |
4 | 4 | import Image from 'next/image'
|
| 5 | +import Link from 'next/link' |
| 6 | + |
| 7 | +import {shortDate} from '@/lib/date-utils.js' |
5 | 8 |
|
6 | 9 | import colors from '@/styles/colors.js'
|
7 | 10 |
|
8 |
| -const Post = ({baseUrl, title, html, authors}) => { |
| 11 | +const Post = ({baseUrl, authors, published_at, reading_time, title, html}) => { |
9 | 12 | useEffect(() => {
|
10 | 13 | const audioPlayers = [...document.querySelectorAll('audio')]
|
11 | 14 | const videoPlayers = [...document.querySelectorAll('video')]
|
@@ -56,6 +59,7 @@ const Post = ({baseUrl, title, html, authors}) => {
|
56 | 59 | <div className='names'>
|
57 | 60 | {authors.map(author => <span key={author.id}>{author.name} </span>)}
|
58 | 61 | </div>
|
| 62 | + <div className='date'>Publié le {shortDate(published_at)} - {reading_time} min de lecture</div> |
59 | 63 | </div>
|
60 | 64 | </div>
|
61 | 65 | </div>
|
@@ -517,9 +521,11 @@ const Post = ({baseUrl, title, html, authors}) => {
|
517 | 521 |
|
518 | 522 | Post.propTypes = {
|
519 | 523 | baseUrl: PropTypes.string.isRequired,
|
| 524 | + authors: PropTypes.array.isRequired, |
| 525 | + published_at: PropTypes.string.isRequired, |
| 526 | + reading_time: PropTypes.number.isRequired, |
520 | 527 | title: PropTypes.string.isRequired,
|
521 |
| - html: PropTypes.node.isRequired, |
522 |
| - authors: PropTypes.array.isRequired |
| 528 | + html: PropTypes.node.isRequired |
523 | 529 | }
|
524 | 530 |
|
525 | 531 | export default Post
|
0 commit comments