0.1.51 • Published 30 days ago

@claudebernard/news-element v0.1.51

Weekly downloads
-
License
-
Repository
-
Last release
30 days ago

elements

An element providing Claude Bernard's latest news about health.

Documentation

See the full documentation for Lit at docs.claudebernard.fr.

You can play with a full demo.

Installation

npm install --save @claudebernard/news-element

Usage

Angular

Import as ES modules in the app.module.ts file.

import '@claudebernard/news-element';

In the html file that will use the custom element :

<bcb-news [hideHeader]="true" (onNewsClicked)="handleClick($event)"></bcb-news>

To test click event :

handleClick(news) {
    alert(news.detail.data.newsTitle);
}

Vue.js

Import as ES modules in the App.vue file.

import '@claudebernard/news-element';

In the html file that will use the custom element :

<bcb-news id="bcb-news" :hideHeader="true"></bcb-news>

To paste in App.vue or in the file that will use the custom element :

<script setup lang="ts">
import { onMounted } from 'vue'

const handleClick = (event) => {
  alert(event.detail.data.newsTitle);
} 

// To test click event :

onMounted(() => {
  const el = document.getElementById('bcb-news');
  el.addEventListener('onNewsClicked', (e) => {
    handleClick(e);
  });
});
</script>

React

Import as ES modules in the App.tsx file. Don't forget to do 'npm install' after importing '@lit-labs/react'.

import {BcbNews} from '@claudebernard/news-element';
import {createComponent} from '@lit-labs/react';
import React, { useState } from 'react'

To paste in App.tsx file or in the file that will use the custom element :

export const BcbNewsReact = createComponent({
  react: React,
  tagName: 'bcb-news',
  elementClass: BcbNews, 
  events: {
    onNewsClicked: 'onNewsClicked'
  }
});

To paste in the return part of the .tsx file :

<BcbNewsReact hideHeader={true} onNewsClicked={(news) => handleClick(news)}></BcbNewsReact>

To test click event :

const handleClick = (news) => {
  alert(news.detail.data.newsTitle)
}

Vanilla JS :

Import as ES modules in the App.js file.

import '@claudebernard/news-element';

To paste in the html part of the file that will use the custom element :

<bcb-news id="bcb-news" hideHeader></bcb-news>

To test click event :

let bcbNewsComponent = document.getElementById('bcb-news');
bcbNewsComponent.addEventListener('onNewsClicked', function(event) {
  alert(event.detail.data.newsTitle);
});

Attributes

NameTypeDefaultDescription
urlstring | The URL to call the Claude Bernard API.
productCodestring | To use if you want to display all the news for a specific product.
newsCountnumber5The number of news to display.
newsSubjectstring0To display all the news whose have the type present in the list.
viewModestringcarouselThe style of the custom element, "static" is the other possible value.
imageReversebooleanfalseThe position of the picture. Default left, right if true.
hideNewsTypebooleanfalseTo display or not the type of the news.
dateFormatstringDD/MM/YYYYThe date format to use.
hideHeaderbooleanfalseTo display or not a header above the custom element.
showImagebooleanfalseTo display or not the image associated to the custom element.
hideMoreLabelbooleanfalseTo display or not the text to redirect to another page.
hideLabNewsbooleanfalseTo display or not the news with laboratory type.
labNewsCountnumber1The number of laboratory news to display. Only is hideLabNews is false.
navigation|Coming soon.

Events

NameDescription
onNewsClickedThe action to be done when clicking on the custom element.

Browser support

Browsers without native custom element support require a polyfill.

  • * Chrome
  • * Firefox
  • * Safari
  • * Microsoft Edge

Custom element checklist

  • [] Public documentation (docs portal)
  • * Functional on Angular, React, Vue
  • [] Unit tested
  • [] Code quality
  • [] Changelog with semantic release
  • [] Available in offline mode
  • [] Best practices compliant
  • [] Validated by QA
  • [] Publicly available
  • [] Based on FHIR
  • [] Example on storybook
  • [] Available demo
  • [] i18n
  • [] Browser support section
  • [] EOL section

Contributing

Read through our contributing guidelines to learn about our submission process, coding rules, and more.

License

Copyright of Cegedim. See LICENSE for details.

0.1.51

30 days ago

0.1.50

7 months ago

0.1.49

8 months ago

0.1.47

8 months ago

0.1.48

8 months ago

0.1.42

12 months ago

0.1.43

12 months ago

0.1.44

12 months ago

0.1.45

12 months ago

0.1.41

12 months ago

0.1.40

12 months ago

0.1.38

12 months ago

0.1.39

12 months ago

0.1.30

12 months ago

0.1.31

12 months ago

0.1.32

12 months ago

0.1.33

12 months ago

0.1.34

12 months ago

0.1.35

12 months ago

0.1.36

12 months ago

0.1.37

12 months ago

0.1.29

1 year ago

0.1.28

1 year ago

0.1.27

1 year ago

0.1.26

1 year ago

0.1.25

1 year ago

0.1.24

1 year ago

0.1.23

1 year ago

0.1.22

1 year ago

0.1.21

1 year ago

0.1.20

1 year ago

0.1.19

1 year ago

0.1.18

1 year ago

0.1.17

1 year ago

0.1.16

1 year ago

0.1.15

1 year ago

0.1.14

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago