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

Side by Side Diff: sky/framework/elements/sky-menu-item.sky

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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/elements/sky-menu-divider.sky ('k') | sky/framework/elements/sky-radio.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="material-element.sky" />
8 <import src="sky-icon.sky" />
9
10 <sky-element attributes="icon:string">
11 <template>
12 <style>
13 :host {
14 display: flex;
15 flex-direction: row;
16 align-items: center;
17 height: 48px;
18 -webkit-user-select: none;
19 }
20 #background {
21 display: flex;
22 flex-direction: row;
23 align-items: center;
24 height: 100%;
25 flex: 1;
26 }
27 #background[highlight] {
28 background: rgba(153, 153, 153, 0.4);
29 }
30 sky-icon {
31 padding: 0px 16px;
32 }
33 #label {
34 font-family: 'Roboto Medium', 'Helvetica';
35 color: #212121;
36 padding: 0px 16px;
37 flex: 1;
38 }
39 </style>
40 <div id="background">
41 <sky-icon size="24" />
42 <div id="label">
43 <content />
44 </div>
45 </div>
46 </template>
47 <script>
48 import "dart:sky";
49
50 @Tagname('sky-menu-item')
51 class SkyMenuItem extends MaterialElement {
52 SkyIcon _icon;
53 Element _label;
54
55 SkyMenuItem() {
56 addEventListener('pointerdown', _handlePointerDown);
57 addEventListener('pointerup', _handlePointerUp);
58 addEventListener('pointercancel', _handlePointerUp);
59 }
60
61 void shadowRootReady() {
62 _icon = shadowRoot.querySelector('sky-icon');
63 _icon.type = "${icon}_grey600";
64 }
65
66 void iconChanged(String oldValue, String newValue) {
67 if (_icon != null)
68 _icon.type = "${newValue}_grey600";
69 }
70
71 void _handlePointerDown(Event event) {
72 shadowRoot.getElementById('background').setAttribute('highlight', '');
73 }
74
75 void _handlePointerUp(Event event) {
76 shadowRoot.getElementById('background').removeAttribute('highlight');
77 }
78 }
79
80 _init(script) => register(script, SkyMenuItem);
81 </script>
82 </sky-element>
OLDNEW
« no previous file with comments | « sky/framework/elements/sky-menu-divider.sky ('k') | sky/framework/elements/sky-radio.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698