@times-components/related-articles
v6.18.4
Published
related articles of an article
Downloads
12,806
Readme
Related Articles
Related articles sit at the bottom of the article, providing similar articles for a user to navigate to should they be interested. The related articles component uses three templates which are configured within the slice layout package:
StandardSlice
LeadAndTwoSlice
OpinionAndTwoSlice
Standard template
This is the simplest template called StandardSlice
, whereby all of the
returned related articles (items
) are of equal importance, and come
pre-ordered (or sorted) from the API.
Lead and Opinion templates
The LeadAndTwoSlice
and OpinionAndTwoSlice
templates each have a "main"
article, and two "supporting" articles (support1
and support2
). This package
takes the "main" (either lead
or opinion
, depending on the template)
article, and passes that as part of a render prop to the slice layout package. A
separate render prop handles the "supporting" articles (as an array). Each
article is iterated over and rendered as appropriate.
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
This package uses yarn (latest) to run unit tests on each platform with jest.
yarn test:web
Visit the official storybook to see our available related articles templates.