36439fce816bc3032175e9a5a223ad85cfe506db
[WebKit.git] / Websites / perf.webkit.org / public / v3 / components / button-base.js
1
2 class ButtonBase extends ComponentBase {
3     didConstructShadowTree()
4     {
5         this.content('button').addEventListener('click', this.createEventHandler(() => {
6             this.dispatchAction('activate');
7         }));
8     }
9
10     static htmlTemplate()
11     {
12         return `<a id="button" href="#"><svg viewBox="0 0 100 100">${this.buttonContent()}</svg></a>`;
13     }
14
15     static buttonContent() { throw 'NotImplemented'; }
16     static sizeFactor() { return 1; }
17
18     static cssTemplate()
19     {
20         const sizeFactor = this.sizeFactor();
21         return `
22             :host {
23                 display: inline-block;
24                 width: ${sizeFactor}rem;
25                 height: ${sizeFactor}rem;
26             }
27
28             a {
29                 vertical-align: bottom;
30                 display: block;
31                 opacity: 0.3;
32             }
33
34             a:hover {
35                 opacity: 0.6;
36             }
37
38             svg {
39                 display: block;
40             }
41         `;
42     }
43 }