Skip to content
Snippets Groups Projects

Add new component for inline notifications

Merged Tögl, Christina requested to merge inline-notification into master
2 unresolved threads
Files
20
import {i18n} from './i18n';
import {createUUID} from './utils'
import {css, html} from 'lit-element';
import DBPLitElement from '@dbp-toolkit/common/dbp-lit-element';
import * as commonStyles from '@dbp-toolkit/common/styles';
import DBPLitElement from '../dbp-lit-element';
import * as commonStyles from '../styles';
/**
* Inline Notification web component
* Inline Notification
*
* Summary can be a string or empty
*
* Body can be a string, html or empty
*
* Type can be primary/info/success/warning/danger (default: info)
*
*/
export class InlineNotification extends DBPLitElement {
constructor() {
super();
this.lang = 'de';
this.type = '';
this.summary = '';
this.body = '';
@@ -18,7 +22,6 @@ export class InlineNotification extends DBPLitElement {
static get properties() {
return {
lang: { type: String },
type: { type: String },
summary: { type: String },
body: { type: String },
@@ -27,7 +30,6 @@ export class InlineNotification extends DBPLitElement {
connectedCallback() {
super.connectedCallback();
i18n.changeLanguage(this.lang);
}
static get styles() {
@@ -59,13 +61,12 @@ export class InlineNotification extends DBPLitElement {
}
render() {
const notificationId = createUUID();
const bodyHtml = this.createBodyHtml();
return html`
<div class="columns">
<div class="column">
<div id="inline-notification-${ notificationId }" class="notification is-${ this.type }">
<div id="inline-notification" class="notification is-${ this.type !== '' ? this.type : 'info' }">
${ this.summary !== '' ? html`<h3>${ this.summary }</h3>` : `` }
${ bodyHtml }
</div>
Loading