Files
developer-roadmap/components/featured-guide/index.js

29 lines
1009 B
JavaScript
Raw Normal View History

2019-11-01 04:14:38 +04:00
import Link from 'next/link';
2019-11-06 23:08:39 +04:00
import formatDate from 'date-fns/format'
2019-11-01 04:14:38 +04:00
import { Author, AuthorImage, AuthorName, BlockLink, BlockMeta, BlockSubtitle, BlockTitle, PublishDate } from './style';
import { findByUsername } from 'lib/author';
2019-11-01 04:14:38 +04:00
const FeaturedGuide = ({ guide }) => {
2019-11-01 04:14:38 +04:00
const author = findByUsername(guide.author) || {};
return (
2019-11-08 18:57:57 +04:00
<div className="col-xl-4 col-lg-6 col-md-6 col-sm-12 col-12 grid-item-container">
<Link href={ guide.url } passHref>
2019-11-01 04:14:38 +04:00
<BlockLink>
<BlockTitle>{ guide.title }</BlockTitle>
<BlockSubtitle>{ guide.featuredDescription || guide.description }</BlockSubtitle>
<BlockMeta>
<Author>
<AuthorImage src={ author.picture } />
<AuthorName>{ author.name }</AuthorName>
</Author>
2019-11-06 23:08:39 +04:00
<PublishDate>{ formatDate(new Date(guide.createdAt), 'MMMM d, yyyy') }</PublishDate>
2019-11-01 04:14:38 +04:00
</BlockMeta>
</BlockLink>
</Link>
</div>
)
};
export default FeaturedGuide;