minor search page fixes

This commit is contained in:
Edin Dazdarevic
2015-03-23 00:19:48 +01:00
parent e23bfe0a7f
commit 0ff47313df
3 changed files with 23 additions and 11 deletions

View File

@@ -14,16 +14,21 @@ var SearchResultsPage = React.createClass({
return SearchStore.getSearchResultsState(); return SearchStore.getSearchResultsState();
}, },
render: function() { render: function() {
var content;
if (this.state.items.length > 0) {
content = <ItemList items={this.state.items} />
} else {
content = <div>Nema rezultata za vašu pretragu.</div>
}
return ( return (
<div> <div>
<h1>Resultati pretrage za {this.state.q}</h1> <h2>Rezultati pretrage za '{this.state.q}'</h2>
{content}
<ItemList items={this.state.items} /> </div>
</div>
); );
}, },
componentWillReceiveProps: function() { componentWillReceiveProps: function() {
this.update(); this.update();

View File

@@ -10,7 +10,7 @@ var SearchBox = React.createClass({
return SearchStore.getSearchBoxState(); return SearchStore.getSearchBoxState();
}, },
onSearchClick: function(e) { onSearchClick: function(e) {
NavigationActions.goToSearchResults(this.state.q); this.doSearch();
e.preventDefault(); e.preventDefault();
}, },
componentDidMount: function() { componentDidMount: function() {
@@ -25,12 +25,17 @@ var SearchBox = React.createClass({
} }
}, },
onSearchBoxChange: function(e) { onSearchBoxChange: function(e) {
SearchActions.searchBoxChange(e.currentTarget.value); SearchActions.searchBoxChange(e.currentTarget.value);
},
doSearch: function() {
if(this.state.q.trim() !== '') {
NavigationActions.goToSearchResults(this.state.q);
}
}, },
onKeyPress: function(e) { onKeyPress: function(e) {
var enterKeyCode = 13; var enterKeyCode = 13;
if(e.which == enterKeyCode) { if(e.which == enterKeyCode) {
NavigationActions.goToSearchResults(this.state.q); this.doSearch();
} }
}, },
render: function() { render: function() {

View File

@@ -1,7 +1,9 @@
body { body {
background-image: url(https://res.cloudinary.com/lfvt7ps2n/image/upload/v1424608718/http_diapers.q-assets.com_images_body_bg_towkjs.gif); /*background-image: url(https://res.cloudinary.com/lfvt7ps2n/image/upload/v1424608718/http_diapers.q-assets.com_images_body_bg_towkjs.gif);*/
background-image : url(http://www.windeln.de/resources/img/bg.svg);
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
font-size: 12px; font-size: 12px;
height:100%;
} }
.container { .container {
background-color: #fff; background-color: #fff;