OLD | NEW |
(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="icon:string"> |
| 10 <template> |
| 11 <style> |
| 12 :host { |
| 13 display: flex; |
| 14 align-items: center; |
| 15 height: 48px; |
| 16 -webkit-user-select: none; |
| 17 } |
| 18 sky-icon { |
| 19 padding: 0px 16px; |
| 20 } |
| 21 #label { |
| 22 font-family: 'Roboto Medium', 'Helvetica'; |
| 23 color: #212121; |
| 24 padding: 0px 16px; |
| 25 flex: 1; |
| 26 } |
| 27 </style> |
| 28 <sky-icon size="24" /> |
| 29 <div id="label"> |
| 30 <content /> |
| 31 </div> |
| 32 </template> |
| 33 <script> |
| 34 import "dart:sky"; |
| 35 |
| 36 @Tagname('sky-menu-item') |
| 37 class SkyMenuItem extends SkyElement { |
| 38 SkyIcon _icon; |
| 39 Element _label; |
| 40 |
| 41 void shadowRootReady() { |
| 42 _icon = shadowRoot.querySelector('sky-icon'); |
| 43 _icon.type = "${icon}_grey600"; |
| 44 } |
| 45 |
| 46 void iconChanged(String oldValue, String newValue) { |
| 47 if (_icon != null) |
| 48 _icon.type = "${newValue}_grey600"; |
| 49 } |
| 50 } |
| 51 |
| 52 _init(script) => register(script, SkyMenuItem); |
| 53 </script> |
| 54 </sky-element> |
OLD | NEW |