Files
developer-roadmap/components/share-page/index.js

35 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-11-02 23:58:17 +04:00
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2019-11-03 01:26:06 +04:00
import { faFacebookSquare, faRedditSquare, faTwitterSquare } from '@fortawesome/free-brands-svg-icons'
2019-11-02 23:58:17 +04:00
2019-11-06 22:59:43 +04:00
import { getFacebookShareUrl, getRedditShareUrl, getTwitterShareUrl } from "lib/url";
2019-11-30 17:07:50 +04:00
import { ShareIconsList, ShareWrap } from './style';
import { ShareIcon } from 'components/share-icon';
2019-11-02 19:41:40 +04:00
2019-11-08 09:45:15 +04:00
const SharePage = ({
url,
title,
twitterUsername,
2019-11-06 22:59:43 +04:00
}) => (
2019-11-02 19:41:40 +04:00
<ShareWrap>
2019-11-30 17:07:50 +04:00
<ShareIconsList className="d-none d-sm-flex">
2019-11-08 09:45:15 +04:00
<ShareIcon
href={ getTwitterShareUrl({
2019-11-14 21:26:01 +04:00
text: `${title} ${twitterUsername ? `by @${twitterUsername}` : ''}`,
2019-11-08 09:45:15 +04:00
url: url
})}
target="_blank"
>
2019-11-30 17:07:50 +04:00
<FontAwesomeIcon icon={ faTwitterSquare } />
2019-11-06 22:59:43 +04:00
</ShareIcon>
2019-11-08 09:45:15 +04:00
<ShareIcon href={ getFacebookShareUrl({ text: title, url: url }) } target="_blank">
2019-11-08 01:32:01 +04:00
<FontAwesomeIcon icon={ faFacebookSquare } />
2019-11-06 22:59:43 +04:00
</ShareIcon>
2019-11-08 09:45:15 +04:00
<ShareIcon href={ getRedditShareUrl({ text: title, url: url })} target="_blank">
2019-11-08 01:32:01 +04:00
<FontAwesomeIcon icon={ faRedditSquare } />
2019-11-06 22:59:43 +04:00
</ShareIcon>
2019-11-02 19:41:40 +04:00
</ShareIconsList>
</ShareWrap>
);
2019-11-08 09:45:15 +04:00
export default SharePage;