Add share page on roadmap pages
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SummaryContainer,
|
SummaryContainer,
|
||||||
Title,
|
Title,
|
||||||
@ -11,6 +10,7 @@ import {
|
|||||||
VersionLink,
|
VersionLink,
|
||||||
VersionList,
|
VersionList,
|
||||||
} from './style';
|
} from './style';
|
||||||
|
import SharePage from '../share-page';
|
||||||
|
|
||||||
const isActiveRoadmap = (loadedVersion, roadmapVersion) => (
|
const isActiveRoadmap = (loadedVersion, roadmapVersion) => (
|
||||||
(loadedVersion === roadmapVersion) ||
|
(loadedVersion === roadmapVersion) ||
|
||||||
@ -35,6 +35,7 @@ const RoadmapSummary = ({ roadmap }) => (
|
|||||||
<Summary className="border-bottom">
|
<Summary className="border-bottom">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<Image src={ roadmap.picture } />
|
<Image src={ roadmap.picture } />
|
||||||
|
<SharePage title={ roadmap.description } url={ roadmap.url } />
|
||||||
</div>
|
</div>
|
||||||
</Summary>
|
</Summary>
|
||||||
</SummaryContainer>
|
</SummaryContainer>
|
||||||
|
@ -10,6 +10,10 @@ export const Header = styled.div`
|
|||||||
export const Summary = styled.div`
|
export const Summary = styled.div`
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 0 0 50px;
|
padding: 0 0 50px;
|
||||||
|
|
||||||
|
.container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const Title = styled.h1`
|
export const Title = styled.h1`
|
||||||
@ -60,4 +64,4 @@ export const VersionLink = styled.a`
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #111111;
|
color: #111111;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -4,25 +4,30 @@ import { faFacebookSquare, faRedditSquare, faTwitterSquare } from '@fortawesome/
|
|||||||
import { getFacebookShareUrl, getRedditShareUrl, getTwitterShareUrl } from "lib/url";
|
import { getFacebookShareUrl, getRedditShareUrl, getTwitterShareUrl } from "lib/url";
|
||||||
import { ShareIcon, ShareIconsList, ShareWrap } from './style';
|
import { ShareIcon, ShareIconsList, ShareWrap } from './style';
|
||||||
|
|
||||||
const ShareGuide = ({
|
const SharePage = ({
|
||||||
guide,
|
url,
|
||||||
guide: {
|
title,
|
||||||
author = {}
|
twitterUsername,
|
||||||
} = {}
|
|
||||||
}) => (
|
}) => (
|
||||||
<ShareWrap>
|
<ShareWrap>
|
||||||
<ShareIconsList className="d-sm-none d-md-none d-lg-flex d-xl-flex">
|
<ShareIconsList className="d-sm-none d-md-none d-lg-flex d-xl-flex">
|
||||||
<ShareIcon href={ getTwitterShareUrl({ text: `${guide.title} by @${author.twitter}`, url: guide.url })} target="_blank">
|
<ShareIcon
|
||||||
|
href={ getTwitterShareUrl({
|
||||||
|
text: `${title}${twitterUsername ? `by @${twitterUsername}` : ''}`,
|
||||||
|
url: url
|
||||||
|
})}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
<FontAwesomeIcon icon={ faTwitterSquare } />
|
<FontAwesomeIcon icon={ faTwitterSquare } />
|
||||||
</ShareIcon>
|
</ShareIcon>
|
||||||
<ShareIcon href={ getFacebookShareUrl({ text: guide.title, url: guide.url }) } target="_blank">
|
<ShareIcon href={ getFacebookShareUrl({ text: title, url: url }) } target="_blank">
|
||||||
<FontAwesomeIcon icon={ faFacebookSquare } />
|
<FontAwesomeIcon icon={ faFacebookSquare } />
|
||||||
</ShareIcon>
|
</ShareIcon>
|
||||||
<ShareIcon href={ getRedditShareUrl({ text: guide.title, url: guide.url })} target="_blank">
|
<ShareIcon href={ getRedditShareUrl({ text: title, url: url })} target="_blank">
|
||||||
<FontAwesomeIcon icon={ faRedditSquare } />
|
<FontAwesomeIcon icon={ faRedditSquare } />
|
||||||
</ShareIcon>
|
</ShareIcon>
|
||||||
</ShareIconsList>
|
</ShareIconsList>
|
||||||
</ShareWrap>
|
</ShareWrap>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default ShareGuide;
|
export default SharePage;
|
@ -3,7 +3,7 @@ import GuideLayout from 'layouts/guide';
|
|||||||
import { serverOnlyProps } from 'lib/server';
|
import { serverOnlyProps } from 'lib/server';
|
||||||
import GuideHeader from 'components/guide-header';
|
import GuideHeader from 'components/guide-header';
|
||||||
import GuideBody from 'components/guide-body';
|
import GuideBody from 'components/guide-body';
|
||||||
import ShareGuide from 'components/share-guide';
|
import SharePage from 'components/share-page';
|
||||||
import GuideFooter from 'components/guide-footer';
|
import GuideFooter from 'components/guide-footer';
|
||||||
import { getRequestedGuide } from 'lib/guide';
|
import { getRequestedGuide } from 'lib/guide';
|
||||||
import Helmet from 'components/helmet';
|
import Helmet from 'components/helmet';
|
||||||
@ -21,7 +21,7 @@ const Guide = ({ guide }) => {
|
|||||||
<GuideHeader guide={ guide } />
|
<GuideHeader guide={ guide } />
|
||||||
<GuideBody>
|
<GuideBody>
|
||||||
<GuideContent />
|
<GuideContent />
|
||||||
<ShareGuide guide={ guide } />
|
<SharePage title={ guide.title } url={ guide.url } twitterUsername={ guide.author.twitter } />
|
||||||
</GuideBody>
|
</GuideBody>
|
||||||
<GuideFooter guide={ guide } />
|
<GuideFooter guide={ guide } />
|
||||||
</GuideLayout>
|
</GuideLayout>
|
||||||
|
Reference in New Issue
Block a user