-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
148 lines (129 loc) · 3.95 KB
/
index.html
File metadata and controls
148 lines (129 loc) · 3.95 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<title>Beadle Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0"
crossorigin="anonymous"
></script>
<style></style>
<script type="module">
import { LitElement, html, css } from 'https://jspm.dev/lit-element@2'
class CounterElement extends LitElement {
static get properties() {
return {
count: { type: Number },
}
}
static get styles() {
return css`
* {
font-size: 200%;
}
span {
width: 4rem;
display: inline-block;
text-align: center;
}
button {
width: 4rem;
height: 4rem;
border: none;
border-radius: 10px;
background-color: seagreen;
color: white;
}
`
}
constructor() {
super()
this.count = 0
}
inc() {
this.count++
}
dec() {
this.count--
}
render() {
return html`
<slot @click="${this.dec}" name="minus">
<button>-</button>
</slot>
<span>${this.count}</span>
<slot @click="${this.inc}" name="plus">
<button>+</button>
</slot>
`
}
}
customElements.define('counter-element', CounterElement)
class BeadleButton extends LitElement {
static get styles() {
return css`
.beadle-btn {
color: red;
}
`
}
_handleClick() {
console.log('clicked')
}
render() {
return html`
<div @click="${this._handleClick}">
<slot><button class="beadle-btn">Default</button></slot>
</div>
<slot name="bart">Hello</slot>
`
}
/*createRenderRoot() {
return this
}*/
}
customElements.define('beadle-button', BeadleButton)
</script>
</head>
<body>
<div style="margin: 20px 0 0 20px">
<beadle-button name="bart">
<button type="button" class="btn btn-primary">Primary</button>
</beadle-button>
<beadle-button>
<button type="button" class="btn btn-secondary">Secondary</button>
</beadle-button>
<beadle-button>
<button type="button" class="btn btn-success">Success</button>
</beadle-button>
<beadle-button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark" slot="bart">Dark</button>
<button type="button" class="btn btn-link">Link</button>
</beadle-button>
<br /><br />
</div>
<beadle-button>
<button type="button" class="btn btn-dark">Submit</button>
</beadle-button>
<br />
<beadle-button></beadle-button>
<beadle-button slot="bart">Test</beadle-button>
<br />
<counter-element>
<span slot="minus"><button type="button" class="btn btn-danger">-</button></span>
<span slot="plus"><button type="button" class="btn btn-warning">+</button></span>
</counter-element>
<counter-element></counter-element>
</body>
</html>