-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlit.js
54 lines (43 loc) · 964 Bytes
/
lit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
import {css, html, LitElement} from 'lit-element/lit-element.js';
import {buttonStyles} from './styles.js';
class ButtonSubtle extends LitElement {
static get properties() {
return {
disabled: {type: Boolean, reflect: true},
src: {type: String},
text: {type: String}
}
}
static get styles() {
return [css`
:host {
display: inline-block;
}
`, buttonStyles];
}
render() {
return html`
<button ?disabled="${this.disabled}">
<img src="${this.src}" alt="">
<span>${this.text}</span>
</button>
`;
}
constructor() {
super();
this.disabled = false;
}
connectedCallback() {
super.connectedCallback();
}
disconnectedCallback() {
super.disconnectedCallback();
}
attributeChangedCallback(attrName, oldVal, newVal) {
super.attributeChangedCallback(attrName, oldVal, newVal);
}
focus() {
this.shadowRoot.querySelector('button').focus();
}
}
customElements.define('button-subtle', ButtonSubtle);