@rhelements/cp-more-like-this

0.1.0 • Public • Published

RHElements More Like This Element

<cp-more-like-this
  q="https://api.access.redhat.com/rs/solutions/1336663"
  content-type="Solution">
</cp-more-like-this>

Attributes

api-url

String value that provides a URL for Solr to query.

Example API URL

https://api.access.redhat.com/rs/search?q=id:1336663&mltDocSearch=true&limit=3

content-type

String value that will set the content type for the string at the top of the component

content-type="Solution"

Results in:
People who viewed this Solution also viewed

content-type="Article"

Results in:
People who viewed this Article also viewed

Events

cp-more-like-this:no-data

If there is an error from the API or no data is found, A custom event, cp-more-like-this:no-data, will be fired and will bubble.

Capture the event example:

document.addEventListener('cp-more-like-this:no-data', function () {
  // react to no data
});

Dependencies

Make sure you have Polyserve and Web Component Tester installed.

npm install -g polyserve web-component-tester

Dev

npm start

Test

npm run test

Build

npm run build

Demo

Run npm start and Polyserve will start a server and open your default browser to the demo page of the element.

Code style

CpMoreLikeThis (and all RHElements) use Prettier to auto-format JS and JSON. The style rules get applied when you commit a change. If you choose to, you can integrate your editor with Prettier to have the style rules applied on every save.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    3
    • latest

Version History

Package Sidebar

Install

npm i @rhelements/cp-more-like-this

Weekly Downloads

8

Version

0.1.0

License

ISC

Unpacked Size

20.9 kB

Total Files

15

Last publish

Collaborators

  • kylebuch8
  • markcaron
  • mwcz