react-templates/playground/samples/weather.rt

18 lines
726 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"
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-07 14:13:35 +01:00
{city.name}, {city.sys.country}
</div>
<button onClick="{this.refresh}">Refresh</button>
</div>