Skip to content

Commit 8ade836

Browse files
committed
updated with template strings
1 parent 59ffd27 commit 8ade836

File tree

1 file changed

+82
-83
lines changed

1 file changed

+82
-83
lines changed

notification.html

+82-83
Original file line numberDiff line numberDiff line change
@@ -50,95 +50,94 @@ <h3>New Message in #customer-support</h3>
5050
var root = notification.createShadowRoot(); // Deprecated to be replaced with attachShadow();
5151

5252
// ::content deprecated to be replaced with ::slotted
53-
root.innerHTML = '\
54-
<style>\
55-
:host(.notification--fadeout) {\
56-
opacity: 0.2;\
57-
}\
58-
:host-context(.green-theme) {\
59-
background-color: green; \
60-
}\
61-
:host {\
62-
background-color: #3498db;\
63-
border-radius: 5px;\
64-
line-height: 1.4; \
65-
width: 420px; \
66-
}\
67-
button {\
68-
background: none;\
69-
border: none;\
70-
box-shadow: none; \
71-
cursor: pointer; \
72-
position: absolute;\
73-
right: 5px; \
74-
top: 10px; \
75-
width: 27px;\
76-
}\
77-
button span {\
78-
display: none;\
79-
}\
80-
button svg {\
81-
fill: var(--notification-close-button-color, #fff);\
82-
height: var(--notification-close-button-size, 27px);\
83-
width: var(--notification-button-size, 27px);\
84-
}\
85-
button:hover svg {\
86-
fill: rgba(0,0,0,0.7);\
87-
}\
88-
p {\
89-
color: var(--notification-text-color, #fff); \
90-
font-size: small;\
91-
margin-bottom: 0; \
92-
text-align: right;\
93-
}\
94-
.wrapper {\
95-
padding: 20px; \
96-
position: relative;\
97-
}\
98-
::content h3, ::content p { \
99-
color: #FFF;\
100-
margin-top: 0;\
101-
padding-top: 0;\
102-
}\
103-
::content p:last-child {\
104-
margin-bottom: 0;\
105-
}\
106-
::content button {\
107-
background: none;\
108-
border: none;\
109-
border-right: 1px solid rgba(0,0,0,0.5);\
110-
border-top: 1px solid rgba(0,0,0,0.5);\
111-
border-top-right-radius: 5px;\
112-
bottom: 0;\
113-
box-shadow: none;\
114-
color: rgba(0,0,0,0.5);\
115-
cursor: pointer;\
116-
font-size: 0.8em;\
117-
left: 0;\
118-
padding: 10px 20px;\
119-
position: absolute;\
120-
}\
121-
</style>\
122-
\
123-
\
124-
<div class="wrapper"> \
125-
<button>\
126-
<svg viewBox="0 0 36 30">\
127-
<polygon points="32.8,4.4 28.6,0.2 18,10.8 7.4,0.2 3.2,4.4 13.8,15 3.2,25.6 7.4,29.8 18,19.2 28.6,29.8 32.8,25.6 22.2,15 "/>\
128-
</svg>\
129-
<span>Close</span>\
130-
</button>\
131-
<content></content>\
132-
<p>1 minute ago</p>\
133-
</div>';
53+
root.innerHTML = `
54+
<style>
55+
:host(.is-active) {
56+
border: 10px solid pink;
57+
}
58+
:host-context(.green-theme) {
59+
background-color: green;
60+
}
61+
:host {
62+
background-color: #3498db;
63+
border-radius: 5px;
64+
line-height: 1.4;
65+
width: 420px;
66+
}
67+
button {
68+
background: none;
69+
border: none;
70+
box-shadow: none;
71+
cursor: pointer;
72+
position: absolute;
73+
right: 15px;
74+
top: 10px;
75+
width: 27px;
76+
}
77+
button span {
78+
display: none;
79+
}
80+
button svg {
81+
fill: var(--notification-close-button-color, #fff);
82+
height: var(--notification-close-button-size, 27px);
83+
width: var(--notification-button-size, 27px);
84+
}
85+
button:hover svg {
86+
fill: rgba(0,0,0,0.7);
87+
}
88+
p {
89+
color: var(--notification-text-color, #fff);
90+
font-size: small;
91+
margin-bottom: 0;
92+
text-align: right;
93+
}
94+
.wrapper {
95+
padding: 20px;
96+
position: relative;
97+
}
98+
::content h3, ::content p {
99+
color: #fff;
100+
margin-top: 0;
101+
padding-top: 0;
102+
}
103+
::content p:last-child {
104+
margin-bottom: 0;
105+
}
106+
::content button {
107+
background: none;
108+
border: none;
109+
border-right: 1px solid rgba(0,0,0,0.5);
110+
border-top: 1px solid rgba(0,0,0,0.5);
111+
border-top-right-radius: 5px;
112+
bottom: 0;
113+
box-shadow: none;
114+
color: rgba(0,0,0,0.5);
115+
cursor: pointer;
116+
font-size: 0.8em;
117+
left: 0;
118+
padding: 10px 20px;
119+
position: absolute;
120+
}
121+
</style>
122+
123+
<div class="wrapper">
124+
<button>
125+
<svg viewBox="0 0 36 30">
126+
<polygon points="32.8,4.4 28.6,0.2 18,10.8 7.4,0.2 3.2,4.4 13.8,15 3.2,25.6 7.4,29.8 18,19.2 28.6,29.8 32.8,25.6 22.2,15 "/>
127+
</svg>
128+
<span>Close</span>
129+
</button>
130+
<content></content>
131+
<p>1 minute ago</p>
132+
</div>`;
134133

135134
// <content> deprecated to be replaced with <slot>
136135

137136
// DEMONSTRATION OF DEEP - Deprecated - use custom props instead
138137
//
139138
// (function() {
140-
// var hawk = document.querySelector('#notification /deep/ p');
141-
// hawk.style.color = 'red';
139+
// var el = document.querySelector('#notification /deep/ p');
140+
// el.style.color = 'red';
142141
// }())
143142

144143
</script>

0 commit comments

Comments
 (0)