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

Unified Diff: sky/examples/stocks/stock.sky

Issue 950073002: Make the stocks app slightly prettier. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/stocks/companylist.sky ('k') | sky/examples/stocks/stocks.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/stocks/stock.sky
diff --git a/sky/examples/stocks/stock.sky b/sky/examples/stocks/stock.sky
index d4ffbd72abb282be50da644d059a5cc0d11f27ec..fcfc9fa02b641f688ef09d01935738f1ab1d3435 100644
--- a/sky/examples/stocks/stock.sky
+++ b/sky/examples/stocks/stock.sky
@@ -8,19 +8,46 @@
<sky-element attributes="ticker:string">
<template>
<style>
+ :host {
+ height: 50px;
+ display: flex;
+ width: 100%;
+ border: 1px solid black;
+ }
+ #ticker {
+ padding: 10px;
+ flex-grow: 1;
+ }
+ #change {
+ padding: 10px;
+ border-radius: 5px;
+ min-width: 60px;
+ text-align: right;
+ }
+ .positive {
+ background-color: green;
+ }
+ .negative {
+ background-color: red;
+ }
</style>
<div id="ticker" />
+ <div id="change" />
</template>
<script>
import "dart:sky";
@Tagname('stock')
class Stock extends SkyElement {
- Element _ticker;
+ var model; // model.Stock
void shadowRootReady() {
- _ticker = shadowRoot.getElementById('ticker');
- _ticker.textContent = ticker;
+ Element ticker = shadowRoot.getElementById('ticker');
+ ticker.textContent = model.symbol;
+
+ Element change = shadowRoot.getElementById('change');
+ change.textContent = "${model.percentChange.toStringAsFixed(2)}%";
+ change.classList.add((model.percentChange < 0) ? 'negative' : 'positive');
}
}
« no previous file with comments | « sky/examples/stocks/companylist.sky ('k') | sky/examples/stocks/stocks.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698