Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: sky/framework/sky-button/sky-button.sky

Issue 809233002: Add super-basic sky widgets. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix typos Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/framework/sky-box/sky-box.sky ('k') | sky/framework/sky-checkbox/sky-checkbox.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 name="sky-button">
9 <template>
10 <style>
11 :host {
12 display: inline-flex;
13 border-radius: 4px;
14 justify-content: center;
15 align-items: center;
16 border: 1px solid blue;
17 -webkit-user-select: none;
18 margin: 5px;
19 }
20 :host([highlight=true]) {
21 background-color: orange;
22 }
23 </style>
24 <content></content>
25 </template>
26 <script>
27 module.exports = class extends SkyElement {
28 created() {
29 this.tabIndex = 0; // Make focusable.
30 this.setHighlight(false);
31
32 this.addEventListener("mousedown", function() {
33 this.setHighlight(true);
34 });
35 this.addEventListener("mouseup", function() {
36 this.setHighlight(false);
37 });
38 this.addEventListener("mouseout", function() {
39 this.setHighlight(false);
40 });
41 }
42 setHighlight(newValue) {
43 // Set both a property and an attribute to keep both parents happy.
44 this.setAttribute('highlight', newValue);
45 this.highlight = newValue;
46 }
47 }.register();
48 </script>
49 </sky-element>
OLDNEW
« no previous file with comments | « sky/framework/sky-box/sky-box.sky ('k') | sky/framework/sky-checkbox/sky-checkbox.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698