| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 3 // Use of this source code is governed by a BSD-style license that can be | |
| 4 // found in the LICENSE file. | |
| 5 --> | |
| 6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> | |
| 7 | |
| 8 <sky-element | |
| 9 name="sky-button" | |
| 10 attributes="highlight:boolean" | |
| 11 on-pointerdown="handlePointerDown" | |
| 12 on-pointerup="handlePointerUp" | |
| 13 on-pointercancel="handlePointerCancel"> | |
| 14 <template> | |
| 15 <style> | |
| 16 :host { | |
| 17 display: inline-flex; | |
| 18 border-radius: 4px; | |
| 19 justify-content: center; | |
| 20 align-items: center; | |
| 21 border: 1px solid blue; | |
| 22 -webkit-user-select: none; | |
| 23 margin: 5px; | |
| 24 } | |
| 25 :host([highlight=true]) { | |
| 26 background-color: orange; | |
| 27 } | |
| 28 </style> | |
| 29 <content /> | |
| 30 </template> | |
| 31 <script> | |
| 32 module.exports = class extends SkyElement { | |
| 33 created() { | |
| 34 super.created(); | |
| 35 | |
| 36 this.tabIndex = 0; // Make focusable. | |
| 37 } | |
| 38 handlePointerDown() { | |
| 39 this.highlight = true; | |
| 40 } | |
| 41 handlePointerUp() { | |
| 42 this.highlight = false; | |
| 43 } | |
| 44 handlePointerCancel() { | |
| 45 this.highlight = false; | |
| 46 } | |
| 47 }.register(); | |
| 48 </script> | |
| 49 </sky-element> | |
| OLD | NEW |