diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-24 19:35:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-24 19:35:12 +0200 |
| commit | c85ab5ad43ccf52881ee224672c41ec30021cf48 (patch) | |
| tree | 8058808d9bfca19383f120c46b34d99ff2f89f63 /src/components/PostMeta/PostMeta.tsx | |
| parent | 52404177c07a2aab7fc894362fb3060dff2431a0 (diff) | |
| parent | 11b9de44a4b2f305a6a484187805e429b2767118 (diff) | |
refactor: use storybook and atomic design (#16)
BREAKING CHANGE: rewrite most of the Typescript types, so the content format (the meta in particular) needs to be updated.
Diffstat (limited to 'src/components/PostMeta/PostMeta.tsx')
| -rw-r--r-- | src/components/PostMeta/PostMeta.tsx | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/components/PostMeta/PostMeta.tsx b/src/components/PostMeta/PostMeta.tsx deleted file mode 100644 index 7fba0be..0000000 --- a/src/components/PostMeta/PostMeta.tsx +++ /dev/null @@ -1,67 +0,0 @@ -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 ( - <dl className={wrapperClass}> - {author && <Author name={author.name} kind={kind} />} - {dates && ( - <Dates - publication={dates.publication} - update={dates.update} - kind={kind} - /> - )} - {readingTime !== undefined && wordsCount !== undefined && ( - <ReadingTime time={readingTime} words={wordsCount} kind={kind} /> - )} - {results !== undefined && <PostsCount total={results} kind={kind} />} - {!isThematic() && thematics && thematics.length > 0 && ( - <Thematics list={thematics} kind={kind} /> - )} - {isThematic() && topics && topics.length > 0 && ( - <Topics list={topics} kind={kind} /> - )} - {website && <Website url={website} kind={kind} />} - {commentCount !== undefined && ( - <CommentsCount total={commentCount} kind={kind} /> - )} - </dl> - ); -}; - -export default PostMeta; |
