Newer
Older
import {createInstance} from './i18n.js';
import {css, html} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import * as commonUtils from '@dbp-toolkit/common/utils';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {TooltipElement} from './tooltip';

Tögl, Christina
committed
import {InfoTooltip} from './info-tooltip';
import DBPLitElement from "@dbp-toolkit/common/dbp-lit-element";
export class TooltipDemo extends ScopedElementsMixin(DBPLitElement) {
constructor() {
super();
this._i18n = createInstance();
this.lang = this._i18n.language;
}
static get scopedElements() {
return {
'dbp-tooltip': TooltipElement,

Tögl, Christina
committed
'dbp-info-tooltip': InfoTooltip,
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
};
}
static get properties() {
return {
...super.properties,
lang: { type: String },
};
}
update(changedProperties) {
changedProperties.forEach((oldValue, propName) => {
if (propName === "lang") {
this._i18n.changeLanguage(this.lang);
}
});
super.update(changedProperties);
}
static get styles() {
// language=css
return [
commonStyles.getThemeCSS(),
commonStyles.getGeneralCSS(),
css`
h1.title {margin-bottom: 1em;}
div.container {margin-bottom: 1.5em; padding-left:20px;}
`
];
}
render() {
return html`
<section class="section">
<div class="container">
<h1 class="title">Tooltip-Demo</h1>
</div>
<div class="container">

Tögl, Christina
committed
<dbp-info-tooltip text-content="tippy info tooltip demo text"></dbp-info-tooltip>
</p>
<p>Mind the gap!
<dbp-tooltip text-content="tippy tooltip demo text" icon-name="information"></dbp-tooltip>
<p>Missing text, default icon:
<dbp-tooltip></dbp-tooltip>
</p>
</div>
</section>
`;
}
}
commonUtils.defineCustomElement('dbp-tooltip-demo', TooltipDemo);