forked from tiny-pilot/tinypilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinline-message.html
More file actions
62 lines (53 loc) · 1.35 KB
/
inline-message.html
File metadata and controls
62 lines (53 loc) · 1.35 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
<template id="inline-message-template">
<style>
:host {
display: none;
padding: 0.5rem 1.5rem;
border-radius: var(--border-radius);
border-width: 1px;
border-style: solid;
text-align: left;
}
:host([show=""]) {
display: block;
}
:host([variant="success"]) {
background-color: var(--brand-green-lighter);
border-color: var(--brand-green);
}
:host([variant="info"]) {
background-color: var(--brand-blue-lighter);
border-color: var(--brand-blue);
}
:host([variant="warning"]) {
background-color: var(--brand-orange-light);
border-color: var(--brand-orange-dark);
}
:host([variant="error"]) {
background-color: var(--brand-red-light);
border-color: var(--brand-red-dark);
}
</style>
<slot></slot>
</template>
<script type="module">
(function () {
const template = document.querySelector("#inline-message-template");
customElements.define(
"inline-message",
class extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: "open" }).appendChild(
template.content.cloneNode(true)
);
}
show() {
this.setAttribute("show", "");
}
hide() {
this.removeAttribute("show");
}
}
);
})();
</script>