Skip to content

Commit

Permalink
Loading example added
Browse files Browse the repository at this point in the history
  • Loading branch information
Vamsi Sai committed Jul 29, 2016
1 parent 6ee13c2 commit 73bbbcf
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions generators/app/templates/src/components/SOSearch/SOSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class SOSearch extends React.Component {
query: React.PropTypes.string.isRequired,
questions: React.PropTypes.array.isRequired,
dispatch: React.PropTypes.func.isRequired,
loaded: React.PropTypes.bool.isRequired
loaded: React.PropTypes.bool.isRequired,
loading: React.PropTypes.bool.isRequired
};

componentWillMount() {
Expand All @@ -31,7 +32,7 @@ class SOSearch extends React.Component {
}

render() {
const { dispatch, query, questions } = this.props;
const { dispatch, query, questions, loading } = this.props;
return (
<div>
<div className="col-md-8">
Expand All @@ -48,7 +49,12 @@ class SOSearch extends React.Component {
dispatch(push('/sosearch/' + e.target.value));
}
} value={query} />
<SOQuestionsList questions={questions} />
{
(loading) ?
<p>Loading...</p>
:
<SOQuestionsList questions={questions} />
}
</div>
<div className="col-md-4">
<SOHot />
Expand All @@ -62,7 +68,8 @@ const mapStateToProps = (state, ownProps) => (
{
query: ownProps.params ? ownProps.params.query : state.sosearch.data.query,
questions: state.sosearch.data.results,
loaded: state.sosearch.loaded
loaded: state.sosearch.loaded,
loading: state.sosearch.loading || false
}
);

Expand Down

0 comments on commit 73bbbcf

Please sign in to comment.