-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAction.js
More file actions
60 lines (54 loc) · 1.58 KB
/
Copy pathAction.js
File metadata and controls
60 lines (54 loc) · 1.58 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
const TEMPLATE = document.createElement("template");
TEMPLATE.innerHTML = `
<style>
.blue.darken-1 {
background-color: #1E88E5 !important;
text-decoration: none;
color: white;
text-transform: uppercase;
padding: 10px 16px;
border-radius: 5px;
}
.waves-effect {
text-decoration:none:
text-transfor:upper;
position: relative;
cursor: pointer;
display: inline-block;
overflow: hidden;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
vertical-align: middle;
z-index: 1;
-webkit-transition: .3s ease-out;
transition: .3s ease-out;
}
</style>
<div class="card-action">
<a class="waves-effect waves-light btn blue darken-1">
</a>
</div>
`;
class Action extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open" });
this.shadowRoot.appendChild(TEMPLATE.content.cloneNode(true));
this.anchor = this.shadowRoot.querySelector("a");
}
get text() {
const TEXT = this.getAttribute("text");
return TEXT || "Default";
}
get link() {
return this.getAttribute("link");
}
connectedCallback() {
this.anchor.href = this.link;
this.anchor.innerText = this.text;
}
}
export default Action;