@times-components/article-lead-asset

1.18.33 • Public • Published

Article Lead Asset

An article lead asset is an unstyled image or video (asset) with an inline caption. The caption is rendered using the renderProps React convention. Consumers are responsible for styling the lead asset by placing it inside of a container and/or by styling the component returned by the caption renderProp.

Usage

// Image
<ArticleLeadAsset
    aspectRatio="16:9"
    displayImage={{
      ratio: "16:9"
      url: "http://crop169.io"
    }}
    leadAsset={{
      caption: "Caption text"
      credits: "Credits text"
      crop169: {
        ratio: "16:9"
        url: "http://crop169.io"
      }
    }}
    renderCaption={({ caption }) => <Caption {...caption } />}
    // Specify the width to render the asset at, this is used for lazy loading
    width={600}
/>

Contributing

Please read CONTRIBUTING.md before contributing to this package

Running the code

Please see our main README.md to get the project running locally

Development

The code can be formatted and linted in accordance with the agreed standards.

yarn fmt
yarn lint

Testing

yarn test:web

Visit the official storybook

Future

Package Sidebar

Install

npm i @times-components/article-lead-asset

Weekly Downloads

3,746

Version

1.18.33

License

BSD-3-Clause

Unpacked Size

133 kB

Total Files

13

Last publish

Collaborators

  • marcincuber
  • newsuk
  • news-tools