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

58 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-11-06 23:08:39 +04:00
import formatDate from 'date-fns/format'
2019-11-01 21:02:55 +04:00
import {
ActionItems,
AuthorImage,
EditGuide,
GuideAuthor,
GuideDate,
GuideMeta,
GuideSubtitle,
GuideTitle,
HeaderWrap,
} from './style';
2019-11-06 22:10:25 +04:00
import { getContributionUrl } from "lib/guide";
2019-11-06 22:56:57 +04:00
import { getTwitterUrl } from "lib/url";
2019-11-10 20:44:56 +04:00
import { faClock, faEnvelope, faArrowLeft } from '@fortawesome/free-solid-svg-icons';
import { BadgeLink, BadgesList, PrimaryBadge, SecondaryBadge, DarkBadge } from 'components/badges';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2019-11-01 20:51:32 +04:00
2019-11-06 22:10:25 +04:00
const GuideHeader = ({
guide,
guide: {
author = {}
} = {}
}) => (
2019-11-01 20:51:32 +04:00
<HeaderWrap className="border-bottom">
<GuideMeta>
2019-11-06 22:56:57 +04:00
<GuideAuthor href={ getTwitterUrl(author.twitter) } target="_blank">
2019-11-06 22:10:25 +04:00
<AuthorImage src={ author.picture } />
{ author.name }
2019-11-01 20:51:32 +04:00
</GuideAuthor>
&middot;
2019-11-06 23:08:39 +04:00
<GuideDate>{ formatDate(new Date(guide.createdAt), 'EEEE, MMMM d yyyy') }</GuideDate>
2019-11-01 21:02:55 +04:00
&middot;
2019-11-06 22:10:25 +04:00
<EditGuide href={ getContributionUrl(guide) } target="_blank">Improve this Guide</EditGuide>
2019-11-01 20:51:32 +04:00
</GuideMeta>
2019-11-06 22:10:25 +04:00
<GuideTitle>{ guide.title }</GuideTitle>
<GuideSubtitle>{ guide.description }</GuideSubtitle>
2019-11-01 21:02:55 +04:00
<ActionItems>
2019-11-10 20:44:56 +04:00
<BadgesList className="mt-4">
<BadgeLink href="/guides">
<SecondaryBadge>
<FontAwesomeIcon icon={faArrowLeft}/>
Other Guides
</SecondaryBadge>
</BadgeLink>
<BadgeLink href="/signup">
<PrimaryBadge>
<FontAwesomeIcon icon={faEnvelope}/>
Send me Updates
</PrimaryBadge>
</BadgeLink>
</BadgesList>
2019-11-01 21:02:55 +04:00
</ActionItems>
2019-11-01 20:51:32 +04:00
</HeaderWrap>
);
2019-11-03 19:50:21 +04:00
export default GuideHeader;