Skip to content

Commit

Permalink
feat: Add no matches text in parameter (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
toofff authored and mrchief committed Mar 24, 2018
1 parent 5b76362 commit 3817ed8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit 3817ed8

Please sign in to comment.