Skip to content

Commit 7ce5df3

Browse files
Merge pull request #689 from Financial-Times/CI-1373-origami-dac-css-inserted-content-01
feat: add new version of o-share to x-live-blog-post
2 parents 279de8f + 5406ed3 commit 7ce5df3

File tree

4 files changed

+46
-13
lines changed

4 files changed

+46
-13
lines changed

components/x-live-blog-post/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"peerDependencies": {
4949
"@financial-times/o-colors": "^6.4.2",
5050
"@financial-times/o-spacing": "^3.2.1",
51-
"@financial-times/o-typography": "^7.2.2"
51+
"@financial-times/o-typography": "^7.2.2",
52+
"@financial-times/o-share" : "^9.0.0"
5253
}
5354
}

components/x-live-blog-post/src/ShareButtons.jsx

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { h } from '@financial-times/x-engine'
2-
2+
import { FacebookSVG, LinkedInSVG, TwitterSVG } from './svgIcons'
33
export default ({ postId, articleUrl, title }) => {
44
const shareUrl = articleUrl ? new URL(articleUrl) : null
55
if (shareUrl) {
@@ -31,9 +31,10 @@ export default ({ postId, articleUrl, title }) => {
3131
href={twitterUrl}
3232
data-trackable="twitter"
3333
>
34-
<span className="o-share__text">
35-
Share ${title} on Twitter (opens in a new window)
36-
</span>
34+
<div className="o-share__icon__image">
35+
<TwitterSVG />
36+
</div>
37+
<span className="o-share__text">Share ${title} on Twitter (opens in a new window)</span>
3738
</a>
3839
</li>
3940
<li className="o-share__action" data-share="facebook">
@@ -43,9 +44,10 @@ export default ({ postId, articleUrl, title }) => {
4344
href={facebookUrl}
4445
data-trackable="facebook"
4546
>
46-
<span className="o-share__text">
47-
Share ${title} on Facebook (opens in a new window)
48-
</span>
47+
<div className="o-share__icon__image">
48+
<FacebookSVG />
49+
</div>
50+
<span className="o-share__text">Share ${title} on Facebook (opens in a new window)</span>
4951
</a>
5052
</li>
5153
<li className="o-share__action" data-share="linkedin">
@@ -55,9 +57,10 @@ export default ({ postId, articleUrl, title }) => {
5557
href={linkedInUrl}
5658
data-trackable="linkedin"
5759
>
58-
<span className="o-share__text">
59-
Share ${title} on LinkedIn (opens in a new window)
60-
</span>
60+
<div className="o-share__icon__image">
61+
<LinkedInSVG />
62+
</div>
63+
<span className="o-share__text">Share ${title} on LinkedIn (opens in a new window)</span>
6164
</a>
6265
</li>
6366
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { h } from '@financial-times/x-engine'
2+
3+
/*
4+
These icons have been copied from Origami as their TSX components are currently incompatible with next-article.
5+
Once this is resolved, these components should be replaced with o-share https://github.com/Financial-Times/origami/tree/main/components/o-share.
6+
*/
7+
export function TwitterSVG() {
8+
return (
9+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
10+
<path d="M417 720c193.2 0 298.9-160.1 298.9-298.9 0-4.5 0-9.1-.3-13.6 20.6-14.9 38.3-33.3 52.4-54.4-19.2 8.5-39.5 14.1-60.3 16.5 21.9-13.1 38.3-33.8 46.2-58.1-20.6 12.2-43.2 20.9-66.7 25.5-39.8-42.3-106.3-44.3-148.6-4.6-27.3 25.7-38.9 63.9-30.4 100.4-84.5-4.2-163.2-44.1-216.5-109.8-27.9 48-13.6 109.4 32.5 140.2-16.7-.5-33.1-5-47.7-13.1v1.3c0 50 35.3 93.1 84.3 103-15.5 4.2-31.7 4.8-47.4 1.8 13.8 42.8 53.2 72.1 98.1 72.9-37.2 29.2-83.1 45.1-130.5 45.1-8.4 0-16.7-.5-25-1.5 48 31 103.9 47.3 161 47.3" />
11+
</svg>
12+
)
13+
}
14+
15+
export function FacebookSVG() {
16+
return (
17+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
18+
<path d="M643.9 342h-48.2c-37.8 0-45.1 18-45.1 44.3v58.1h90.1l-11.7 91h-78.4V769h-94V535.5H378v-91h78.6v-67.1c0-77.9 47.6-120.3 117.1-120.3 33.3 0 61.9 2.5 70.2 3.6V342z" />
19+
</svg>
20+
)
21+
}
22+
23+
export function LinkedInSVG() {
24+
return (
25+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
26+
<path d="M264.4 426.2h106.2v341.4H264.4V426.2zm53.2-169.7c-34.1 0-61.6 27.6-61.6 61.5 0 34 27.5 61.5 61.6 61.5 33.9 0 61.5-27.6 61.5-61.5-.1-34-27.6-61.5-61.5-61.5zm323.1 161.2c-51.6 0-86.2 28.3-100.4 55.1h-1.5v-46.7H437.2v341.4h106V598.7c0-44.5 8.4-87.7 63.6-87.7 54.5 0 55.1 50.9 55.1 90.5v166H768V580.3c0-91.9-19.9-162.6-127.3-162.6z" />
27+
</svg>
28+
)
29+
}

components/x-live-blog-post/storybook/index.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react'
22
import { LiveBlogPost } from '../src/LiveBlogPost'
33
import BuildService from '../../../.storybook/build-service'
4-
54
import '../src/LiveBlogPost.scss'
65

76
const dependencies = {
8-
'o-fonts': '^5.3.0'
7+
'o-fonts': '^5.3.0',
8+
'o-share': '^9.0.0'
99
}
1010

1111
export default {

0 commit comments

Comments
 (0)