-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple-card.js
77 lines (68 loc) · 1.64 KB
/
simple-card.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
class SimpleCard extends Bbconf2017LitElement(HTMLElement) {
get styleTemplate() {
return html`
<style>
:host {
position: relative;
display: block;
width: 100%;
background: #ffffff;
border-radius: 4px;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 1px 5px 0 rgba(0, 0, 0, 0.12),
0 3px 1px -2px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
line-height: 1.5;
font-weight: normal;
}
#header ::slotted(*),
#body ::slotted(*),
#footer ::slotted(*){
padding: 24px;
}
#header {
color: inherit;
}
#header ::slotted(h1),
#header ::slotted(h2),
#header ::slotted(h3),
#header ::slotted(h4),
#header ::slotted(h5),
#header ::slotted(h6) {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
</style>
`;
}
get headerTemplate() {
return html`
<header id="header">
<slot name="header" id="headerslot"></slot>
</header>
`;
}
get bodyTemplate() {
return html`
<div id="body">
<slot id="bodyslot"></slot>
</div>
`;
}
get footerTemplate() {
return html`
<footer id="footer">
<slot name="footer" id="footerslot"></slot>
</footer>
`;
}
render() {
return html`
${this.styleTemplate}
${this.headerTemplate}
${this.bodyTemplate}
${this.footerTemplate}
`;
}
}
customElements.define('simple-card',SimpleCard);