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

Side by Side Diff: sky/examples/stocks/stock.sky

Issue 954023002: Implement quantum ink splashes (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: nits 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 | « no previous file | sky/framework/material-element.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 // Copyright 2015 The Chromium Authors. All rights reserved. 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 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 --> 5 -->
6 <import src="/sky/framework/material-element.sky" />
6 <import src="/sky/framework/sky-element.sky" /> 7 <import src="/sky/framework/sky-element.sky" />
7 <import src="stock-arrow.sky" /> 8 <import src="stock-arrow.sky" />
8 9
9 <sky-element> 10 <sky-element>
10 <template> 11 <template>
11 <style> 12 <style>
12 :host { 13 :host {
13 // TODO(eseidel): Why does setting height here make this too big? 14 // TODO(eseidel): Why does setting height here make this too big?
14 // height: 48px; 15 // height: 48px;
15 max-height: 48px; 16 max-height: 48px;
(...skipping 23 matching lines...) Expand all
39 </style> 40 </style>
40 <stock-arrow id="arrow" /> 41 <stock-arrow id="arrow" />
41 <div id="ticker" /> 42 <div id="ticker" />
42 <div id="last-sale" /> 43 <div id="last-sale" />
43 <div id="change" /> 44 <div id="change" />
44 </template> 45 </template>
45 <script> 46 <script>
46 import "dart:sky"; 47 import "dart:sky";
47 48
48 @Tagname('stock') 49 @Tagname('stock')
49 class Stock extends SkyElement { 50 class Stock extends MaterialElement {
50 var model; // model.Stock 51 var model; // model.Stock
51 52
52 void shadowRootReady() { 53 void shadowRootReady() {
53 shadowRoot.getElementById('ticker').textContent = model.symbol; 54 shadowRoot.getElementById('ticker').textContent = model.symbol;
54 55
55 Element lastSale = shadowRoot.getElementById('last-sale'); 56 Element lastSale = shadowRoot.getElementById('last-sale');
56 lastSale.textContent = "\$${model.lastSale.toStringAsFixed(2)}"; 57 lastSale.textContent = "\$${model.lastSale.toStringAsFixed(2)}";
57 58
58 Element change = shadowRoot.getElementById('change'); 59 Element change = shadowRoot.getElementById('change');
59 String changeString = "${model.percentChange.toStringAsFixed(2)}%"; 60 String changeString = "${model.percentChange.toStringAsFixed(2)}%";
60 if (model.percentChange > 0) 61 if (model.percentChange > 0)
61 changeString = "+" + changeString; 62 changeString = "+" + changeString;
62 change.textContent = changeString; 63 change.textContent = changeString;
63 64
64 StockArrow arrow = shadowRoot.getElementById('arrow'); 65 StockArrow arrow = shadowRoot.getElementById('arrow');
65 arrow.change = model.percentChange; 66 arrow.change = model.percentChange;
66 } 67 }
67 } 68 }
68 69
69 _init(script) => register(script, Stock); 70 _init(script) => register(script, Stock);
70 </script> 71 </script>
71 </sky-element> 72 </sky-element>
OLDNEW
« no previous file with comments | « no previous file | sky/framework/material-element.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698