Skip to content

Commit 8c6ea7a

Browse files
committed
Share icons Thrive #4679
1 parent 94c6cad commit 8c6ea7a

File tree

5 files changed

+65
-4
lines changed

5 files changed

+65
-4
lines changed

src/assets/images/icon-facebook.svg

Lines changed: 11 additions & 0 deletions
Loading

src/assets/images/icon-linkedIn.svg

Lines changed: 11 additions & 0 deletions
Loading

src/assets/images/icon-twitter.svg

Lines changed: 11 additions & 0 deletions
Loading

src/shared/components/Contentful/Article/Article.jsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ import LoadingIndicator from 'components/LoadingIndicator';
1515
import YouTubeVideo from 'components/YouTubeVideo';
1616
import moment from 'moment';
1717
import localStorage from 'localStorage';
18-
import { config, Link } from 'topcoder-react-utils';
19-
import ShareSocial from 'components/challenge-detail/Specification/SideBar/ShareSocial';
18+
import { config, Link, isomorphy } from 'topcoder-react-utils';
19+
import qs from 'qs';
2020
// SVGs and assets
2121
import GestureIcon from 'assets/images/icon-gesture.svg';
2222
import ReadMoreArrow from 'assets/images/read-more-arrow.svg';
23-
import qs from 'qs';
23+
import IconFacebook from 'assets/images/icon-facebook.svg';
24+
import IconTwitter from 'assets/images/icon-twitter.svg';
25+
import IconLinkedIn from 'assets/images/icon-linkedIn.svg';
2426

2527
const htmlToText = require('html-to-text');
2628

@@ -104,6 +106,10 @@ export default class Article extends React.Component {
104106
spaceName, environment, preview,
105107
};
106108
const { upvotes, downvotes } = this.state || {};
109+
let shareUrl;
110+
if (isomorphy.isClientSide()) {
111+
shareUrl = encodeURIComponent(window.location.href);
112+
}
107113

108114
return (
109115
<React.Fragment>
@@ -180,7 +186,17 @@ export default class Article extends React.Component {
180186
</div>
181187
<div className={theme.separator} />
182188
<h3 className={theme.label}>share</h3>
183-
<ShareSocial />
189+
<div className={theme.shareButtons}>
190+
<a href={`https://www.linkedin.com/sharing/share-offsite/?url=${shareUrl}`} target="_blank" rel="noopener noreferrer">
191+
<IconLinkedIn />
192+
</a>
193+
<a href={`https://www.facebook.com/sharer/sharer.php?u=${shareUrl}&src=share_button`} target="_blank" rel="noopener noreferrer">
194+
<IconFacebook />
195+
</a>
196+
<a href={`https://twitter.com/intent/tweet?url=${shareUrl}`} target="_blank" rel="noopener noreferrer">
197+
<IconTwitter />
198+
</a>
199+
</div>
184200
<div className={theme.mobileSeparator} />
185201
</div>
186202
{/* Content */}

src/shared/components/Contentful/Article/themes/default.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
@import "~styles/mixins";
22
@import "~components/Contentful/default";
33

4+
.shareButtons {
5+
margin-top: 10px;
6+
7+
a {
8+
margin-right: 5px;
9+
10+
&:last-child {
11+
margin-right: 0;
12+
}
13+
}
14+
}
15+
416
.contentContainer,
517
.contentContainerWithBanner {
618
max-width: $screen-lg;

0 commit comments

Comments
 (0)