Skip to content

Commit

Permalink
chore(search): update badge count label (#4207)
Browse files Browse the repository at this point in the history
* updates the badge count label to add a `+` sign if the number of
search results returned for a search category exceeds the page size sent
with the search request.
  • Loading branch information
icfantv authored Oct 3, 2017
1 parent 6cf16e1 commit 19c5c7e
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as React from 'react';
import * as classNames from 'classnames';
import { BindAll } from 'lodash-decorators';

import { SearchService } from 'core/search/search.service';

export interface ISearchResultGroup {
category: string;
count: number;
Expand Down Expand Up @@ -31,6 +33,16 @@ export class SearchResultGroup extends React.Component<ISearchResultGroupProps>
}
}

private getCountLabel(count: number): string {

let result = `${count}`;
if (count >= SearchService.DEFAULT_PAGE_SIZE) {
result += '+';
}

return result;
}

public render(): React.ReactElement<SearchResultGroup> {
const { isActive, searchResultGroup } = this.props;
const { count, iconClass, name } = searchResultGroup;
Expand All @@ -45,7 +57,7 @@ export class SearchResultGroup extends React.Component<ISearchResultGroupProps>
<div className={className} onClick={this.handleClick}>
<span className={`search-group-icon ${iconClass}`}/>
<div className="search-group-name">{name}</div>
<div className="badge">{count}</div>
<div className="badge">{this.getCountLabel(count)}</div>
</div>
);
}
Expand Down

0 comments on commit 19c5c7e

Please sign in to comment.