forked from web-platform-tests/wpt.fyi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo-banner.js
71 lines (64 loc) · 1.57 KB
/
info-banner.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
/**
* Copyright 2018 The WPT Dashboard Project. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
`<info-banner>` is a stateless component for displaying an information banner,
of type info, warning, or error.
*/
import '../node_modules/@polymer/paper-styles/color.js';
import { html, PolymerElement } from '../node_modules/@polymer/polymer/polymer-element.js';
class InfoBanner extends PolymerElement {
static get template() {
return html`
<style>
:host {
display: block;
margin-bottom: 1em;
margin-top: 1em;
}
.banner {
display: flex;
flex-direction: row;
justify-items: center;
justify-content: space-between;
background-color: var(--paper-blue-100);
border-left: solid 4px var(--paper-blue-300);
}
.main {
padding: 0.5em;
}
small {
display: flex;
}
.banner.error {
background-color: var(--paper-red-100);
border-left: solid 4px var(--paper-red-300);
}
</style>
<section class\$="banner [[type]]">
<span class="main">
<slot></slot>
</span>
<small>
<slot name="small"></slot>
</small>
</section>
`;
}
static get is() {
return 'info-banner';
}
static get properties() {
return {
type: {
type: String,
value: 'info',
reflectToAttribute: true,
},
};
}
}
window.customElements.define(InfoBanner.is, InfoBanner);
export { InfoBanner };