react-templates/playground/samples/weather.rt

19 lines
797 B
Plaintext
Raw Normal View History

2014-12-07 14:13:35 +01:00
<div>
<h4>Cities weather report</h4>
2014-12-28 10:47:34 +01:00
<input placeholder="Type a city to add"
2014-12-30 09:42:31 +01:00
style="width:130px"
2014-12-28 10:47:34 +01:00
valueLink="{this.linkState('cityToAdd')}"
onKeyDown="(e)=>if (e.keyCode === 13) { e.preventDefault(); this.addCity(); }"/>
2014-12-07 14:13:35 +01:00
<button onClick="{this.addCity}">Add</button>
2014-12-28 10:47:34 +01:00
<div key="preloader" rt-if="this.state.loading">
-- Loading --
</div>
2014-12-07 14:13:35 +01:00
<div rt-repeat="city in this.state.info" key="{city.id}">
{cityIndex+1})
2014-12-28 10:47:34 +01:00
<img rt-repeat="weather in city.weather"
src="http://openweathermap.org/img/w/{weather.icon}.png"
title="{weather.description}"/>
2014-12-30 09:42:31 +01:00
<span style="white-space:nowrap">{city.name}, {city.sys.country}</span>
2014-12-07 14:13:35 +01:00
</div>
<button onClick="{this.refresh}">Refresh</button>
</div>