Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add no matches text in parameter #62

Merged
merged 2 commits into from
Mar 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ A lightweight and fast control to render a select component that can display hie
* [onNodeToggle](#onnodetoggle)
* [data](#data)
* [placeholderText](#placeholdertext)
* [noMatchesText](#noMatchesText)
* [keepTreeOnSearch](#keeptreeonsearch)
* [simpleSelect](#simpleselect)
* [Styling and Customization](#styling-and-customization)
Expand Down Expand Up @@ -225,6 +226,12 @@ Type: `string`

The text to display as placeholder on the search box. Defaults to `Choose...`

### noMatchesText

Type: `string`

The text to display when the search does not find results in the content list. Defaults to `No matches found`

### keepTreeOnSearch

Type: `bool`
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class DropdownTreeSelect extends Component {
onChange: PropTypes.func,
onAction: PropTypes.func,
onNodeToggle: PropTypes.func,
simpleSelect: PropTypes.bool
simpleSelect: PropTypes.bool,
noMatchesText: PropTypes.string
}

constructor (props) {
Expand Down Expand Up @@ -166,7 +167,7 @@ class DropdownTreeSelect extends Component {
{this.state.showDropdown && (
<div className={cx('dropdown-content')}>
{this.state.allNodesHidden ? (
<span className="no-matches">No matches found</span>
<span className="no-matches">{this.props.noMatchesText || 'No matches found'}</span>
) : (
<Tree
data={this.state.tree}
Expand Down