diff options
author | Dessalines <tyhou13@gmx.com> | 2020-07-09 20:11:05 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-07-09 20:11:05 -0400 |
commit | d271ae67aa45cd1e185190864facb0cd5e797a23 (patch) | |
tree | 2d720b59bd2485d7f7ffc4a641ab4683445eb20f /ui/src/components/search.tsx | |
parent | db09730d5f391c37bde87f59ed2ea6f3418034e4 (diff) | |
parent | 961d65c0ee304b97cc3932d7e2a7334a823e2969 (diff) |
Merge branch 'master' into remove_twemoji
Diffstat (limited to 'ui/src/components/search.tsx')
-rw-r--r-- | ui/src/components/search.tsx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/ui/src/components/search.tsx b/ui/src/components/search.tsx index 2588528a..dd219ba9 100644 --- a/ui/src/components/search.tsx +++ b/ui/src/components/search.tsx @@ -148,7 +148,7 @@ export class Search extends Component<any, SearchState> { {this.state.type_ == SearchType.Posts && this.posts()} {this.state.type_ == SearchType.Communities && this.communities()} {this.state.type_ == SearchType.Users && this.users()} - {this.noResults()} + {this.resultsCount() == 0 && <span>{i18n.t('no_results')}</span>} {this.paginator()} </div> ); @@ -383,26 +383,26 @@ export class Search extends Component<any, SearchState> { {i18n.t('prev')} </button> )} - <button - class="btn btn-sm btn-secondary" - onClick={linkEvent(this, this.nextPage)} - > - {i18n.t('next')} - </button> + + {this.resultsCount() > 0 && ( + <button + class="btn btn-sm btn-secondary" + onClick={linkEvent(this, this.nextPage)} + > + {i18n.t('next')} + </button> + )} </div> ); } - noResults() { + resultsCount(): number { let res = this.state.searchResponse; return ( - <div> - {res && - res.posts.length == 0 && - res.comments.length == 0 && - res.communities.length == 0 && - res.users.length == 0 && <span>{i18n.t('no_results')}</span>} - </div> + res.posts.length + + res.comments.length + + res.communities.length + + res.users.length ); } |