import { Author, CommentsCount, Dates, PostsCount, ReadingTime, Thematics, Topics, Website, } from '@components/MetaItems'; import { MetaKind } from '@ts/types/app'; import { ArticleMeta } from '@ts/types/articles'; import { useRouter } from 'next/router'; import styles from './PostMeta.module.scss'; const PostMeta = ({ meta, kind = 'list', }: { meta: ArticleMeta; kind?: MetaKind; }) => { const { author, commentCount, dates, readingTime, results, thematics, topics, website, wordsCount, } = meta; const { asPath } = useRouter(); const isThematic = () => asPath.includes('/thematique/'); const wrapperClass = styles[`wrapper--${kind}`]; return (
{author && } {dates && ( )} {readingTime !== undefined && wordsCount !== undefined && ( )} {results !== undefined && } {!isThematic() && thematics && thematics.length > 0 && ( )} {isThematic() && topics && topics.length > 0 && ( )} {website && } {commentCount !== undefined && ( )}
); }; export default PostMeta;