-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from andela/ft-social-share-164047033
feature-#164047033-User be able to share an Article through Facebook,Twitter and Email.
- Loading branch information
Showing
6 changed files
with
115 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
FacebookShareButton, | ||
EmailShareButton, | ||
TwitterShareButton, | ||
FacebookIcon, | ||
EmailIcon, | ||
TwitterIcon, | ||
} from 'react-share'; | ||
import './social.scss'; | ||
|
||
const SocialShare = ({ slug, title }) => ( | ||
<div> | ||
<div> | ||
<TwitterShareButton | ||
url={`https://ah-olympians.herokuapp.com/article/${slug}`} | ||
quote={title} | ||
windowWidth={750} | ||
windowHeight={600} | ||
className="social" | ||
> | ||
<TwitterIcon size={32} round /> | ||
</TwitterShareButton> | ||
</div> | ||
<div> | ||
<FacebookShareButton | ||
url={`https://ah-olympians.herokuapp.com/article/${slug}`} | ||
quote={title} | ||
windowWidth={750} | ||
windowHeight={600} | ||
className="social" | ||
> | ||
<FacebookIcon size={32} round /> | ||
</FacebookShareButton> | ||
</div> | ||
<div> | ||
<EmailShareButton | ||
windowWidth={750} | ||
windowHeight={600} | ||
url={`https://ah-olympians.herokuapp.com/article/${slug}`} | ||
quote={title} | ||
className="social" | ||
> | ||
<EmailIcon size={32} round /> | ||
</EmailShareButton> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default SocialShare; | ||
|
||
SocialShare.propTypes = { | ||
slug: PropTypes.string.isRequired, | ||
title: PropTypes.string.isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import SocialShare from './index'; | ||
|
||
test('should test social sharing', () => { | ||
const wrapper = shallow(<SocialShare />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.social { | ||
cursor: pointer; | ||
} |