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

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

Issue 947383002: Add <sky-icon> to access material design widgets (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/examples/stocks/stocks.sky ('k') | no next file » | 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
8 <sky-element attributes="type:string, size:number">
9 <template>
10 <img />
11 </template>
12 <script>
13 import "dart:sky";
14
15 const String kAssetBase = '/sky/assets/material-design-icons';
16
17 @Tagname('sky-icon')
18 class SkyIcon extends SkyElement {
19 void shadowRootReady() {
20 Element img = shadowRoot.firstElementChild;
21 int intSize = size.floor();
22 img.style['height'] = '${intSize}px';
23 img.style['width'] = '${intSize}px';
24 List<String> parts = type.split('/');
25 String category = parts[0];
26 String subtype = parts[1];
27 img.src = '${kAssetBase}/${category}/2x_web/ic_${subtype}_${intSize}dp.png';
28 }
29 }
30
31 _init(script) => register(script, SkyIcon);
32 </script>
33 </sky-element>
OLDNEW
« no previous file with comments | « sky/examples/stocks/stocks.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698