react-templates/playground/samples/weather.rt

19 lines
797 B
Plaintext

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