diff --git a/components/x-live-blog-post/readme.md b/components/x-live-blog-post/readme.md
index 725846c76..b3d189401 100644
--- a/components/x-live-blog-post/readme.md
+++ b/components/x-live-blog-post/readme.md
@@ -52,3 +52,5 @@ Feature | Type | Notes
`publishedTimestamp`| String | Deprecated - ISO timestamp of publish date
`articleUrl` | String | Url of the main article that includes this post
`showShareButtons` | Bool | default: `false` - Shows social media share buttons when `true`
+`backToTop` | String | Function | Shows the back to top link at the bottom of posts and manages navigating to `selected top` with a javascript function or a hashed href (string). If this prop is a string it will rely on standard browser behaviour to navigate to the element `id` provided that represents the top. If this prop is a function then that function should control the experience of navigating/scrolling to the top position. When using a function please call event.preventDefault() at the top level.
+
diff --git a/components/x-live-blog-post/src/LiveBlogPost.jsx b/components/x-live-blog-post/src/LiveBlogPost.jsx
index 709a822a1..0f217f2ef 100644
--- a/components/x-live-blog-post/src/LiveBlogPost.jsx
+++ b/components/x-live-blog-post/src/LiveBlogPost.jsx
@@ -1,4 +1,5 @@
-import { h } from '@financial-times/x-engine'
+/* eslint-disable jsx-a11y/no-static-element-interactions */
+import { h, Fragment } from '@financial-times/x-engine'
import ShareButtons from './ShareButtons'
import Timestamp from './Timestamp'
import styles from './LiveBlogPost.scss'
@@ -17,11 +18,43 @@ const LiveBlogPost = (props) => {
articleUrl,
showShareButtons = false,
byline,
- ad
+ ad,
+ backToTop
} = props
const showBreakingNewsLabel = standout.breakingNews || isBreakingNews
+ let BackToTopComponent
+
+ if (backToTop) {
+ if (typeof backToTop === 'string') {
+ const processTopRef = (ref) => {
+ return ref.includes('#') ? ref : `#${ref}`
+ }
+ BackToTopComponent = (
+
+ Back to top
+
+ )
+ }
+
+ if (typeof backToTop === 'function') {
+ BackToTopComponent = (
+
+ )
+ }
+ }
+
return (
{
className={`${styles['live-blog-post__body']} n-content-body article--body`}
dangerouslySetInnerHTML={{ __html: bodyHTML || content }}
/>
- {showShareButtons && }
+
+ )
+}
+
+ContentBodyWithBackToTopButton.args = {
+ title: 'Turkey’s virus deaths may be 25% higher than official figure',
+ byline: 'George Russell',
+ isBreakingNews: false,
+ standout: {
+ breakingNews: false
+ },
+ bodyHTML:
+ '
Turkey’s death toll from coronavirus could be as much as 25 per cent higher than the government’s official tally, adding the country of 83m people to the raft of nations that have struggled to accurately capture the impact of the pandemic.
\n
Ankara has previously rejected suggestions that municipal data from Istanbul, the epicentre of the country’s Covid-19 outbreak, showed that there were more deaths from the disease than reported.
\n
But an analysis of individual death records by the Financial Times raises questions about the Turkish government’s explanation for a spike in all-cause mortality in the city of almost 16m people.