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

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

Issue 999873002: Move sky-*.sky into framework/elements (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: One missing Created 5 years, 9 months 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-button.sky ('k') | sky/framework/sky-drawer.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 2015 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-element.sky" />
7 <import src="sky-icon.sky" />
8
9 <sky-element attributes="checked:boolean">
10 <template>
11 <style>
12 :host {
13 display: inline-block;
14 -webkit-user-select: none;
15 margin: 8px 16px;
16 }
17 </style>
18 <sky-icon size="18" />
19 </template>
20 <script>
21 import "dart:sky";
22
23 const String _kOnIcon = 'toggle/check_box_black';
24 const String _kOffIcon = 'toggle/check_box_outline_blank_black';
25
26 @Tagname('sky-checkbox')
27 class SkyCheckbox extends SkyElement {
28 SkyIcon _icon;
29
30 SkyCheckbox() {
31 addEventListener('click', _handleClick);
32 }
33
34 void shadowRootReady() {
35 _icon = shadowRoot.querySelector('sky-icon');
36 _icon.type = checked ? _kOnIcon : _kOffIcon;
37 }
38
39 void checkedChanged(bool oldValue, bool newValue) {
40 if (_icon != null)
41 _icon.type = newValue ? _kOnIcon : _kOffIcon;
42 }
43
44 void _handleClick(_) {
45 checked = !checked;
46 }
47 }
48
49 _init(script) => register(script, SkyCheckbox);
50 </script>
51 </sky-element>
OLDNEW
« no previous file with comments | « sky/framework/sky-button.sky ('k') | sky/framework/sky-drawer.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698