Socket
Socket
Sign inDemoInstall

@financial-times/x-live-blog-post

Package Overview
Dependencies
94
Maintainers
10
Versions
136
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @financial-times/x-live-blog-post

This module displays a live blog post with title, body, timestamp and share buttons.


Version published
Weekly downloads
2K
increased by13.78%
Maintainers
10
Install size
83.0 kB
Created
Weekly downloads
 

Readme

Source

x-live-blog-post

This module displays a live blog post with title, body, timestamp and share buttons.

Installation

This module is supported on Node 16 and is distributed on npm.

npm install --save @financial-times/x-live-blog-post

The x-engine module is used to inject your chosen runtime into the component. Please read the x-engine documentation first if you are consuming x- components for the first time in your application.

Usage

The components provided by this module are all functions that expect a map of properties. They can be used with vanilla JavaScript or JSX (If you are not familiar check out WTF is JSX first). For example if you were writing your application using React you could use the component like this:

import React from 'react';
import { LiveBlogPost } from '@financial-times/x-live-blog-post';

// A == B == C
const a = LiveBlogPost(props);
const b = <LiveBlogPost {...props} />;
const c = React.createElement(LiveBlogPost, props);

All x- components are designed to be compatible with a variety of runtimes, not just React. Check out the x-engine documentation for a list of recommended libraries and frameworks.

Properties

Deprecated properties should only be used when data comes from the Wordpress CMS. Once we decommission live blogs powered by Wordpress these properties can be removed.

FeatureTypeNotes
idStringUnique id to reference the content
postIdStringDeprecated - Unique id to reference the content
titleStringTitle of the content
bodyHTMLStringBody of the content, if data is from next elasticsearch
bodyObjectStructured Body of the content, if data is from cp-content-pipeline-api
bylineString or ObjectByline for the post, sometimes used to render the author's name. Will be an object if data is from cp-content-pipeline-api
renderRichTextFunctionA component to use for rendering structured content, e.g. RichText from cp-content-pipeline-ui. Required when rendering with data from cp-content-pipeline-api.
contentStringDeprecated - Body of the content
isBreakingNewsBoolWhen true displays "breaking news" tag
publishedDateStringISO timestamp of publish date
publishedTimestampStringDeprecated - ISO timestamp of publish date
articleUrlStringUrl of the main article that includes this post
showShareButtonsBooldefault: false - Shows social media share buttons when true
backToTopString or FunctionShows 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.

Keywords

FAQs

Last updated on 15 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc