import React from "react"; import { BiHeart } from "react-icons/bi"; import { FaRegComment } from "react-icons/fa"; import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; dayjs.extend(relativeTime); const ArticleComponent = (props) => { const { title, cover_image, tag_list, url, comments_count, positive_reactions_count, public_reactions_count, user, published_at, } = props.data; //console.log("article data", props.data); return (
{cover_image && (   )}
{user.username} {new Date(published_at).toLocaleDateString(undefined, { day: "numeric", month: "long", })}   ({dayjs(published_at).fromNow()})

{title}

{tag_list.map((tag, id) => { return ( #{tag} ); })}
{public_reactions_count + positive_reactions_count > 0 && (   {public_reactions_count + positive_reactions_count}   reactions )}   {comments_count > 0 ? ( {comments_count}   comments ) : null} {comments_count === 0 ? ( {comments_count}   Add comment ) : null}
1 min read
); }; export default ArticleComponent;