Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Added No results found text in combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
KV106606Viswanath committed Oct 27, 2023
1 parent 1be05ff commit fad95ea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/terra-form-select/src/combobox/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ClearOption from '../shared/_ClearOption';
import MenuUtil from '../shared/_MenuUtil';
import SharedUtil from '../shared/_SharedUtil';
import styles from '../shared/_Menu.module.scss';
import NoResults from '../shared/_NoResults';

const cx = classNamesBind.bind(styles);

Expand Down Expand Up @@ -119,16 +120,21 @@ class Menu extends React.Component {
*/
static getDerivedStateFromProps(props, state) {
const {
clearOptionDisplay, searchValue,
clearOptionDisplay, searchValue, noResultContent,
} = props;

const hasNoResults = false;
let hasNoResults = false;
const hasMaxSelection = false;
let hasAddOption = false;

let children = MenuUtil.filter(props.children, props.searchValue, props.optionFilter);
children = MenuUtil.updateSelectionState(children, props);

if (!children.length) {
children.push(<NoResults noResultContent={noResultContent} value={searchValue} />);
hasNoResults = true;
}

if (Menu.shouldAllowFreeText(props, children)) {
children.push(<AddOption value={searchValue} />);
hasAddOption = true;
Expand Down

0 comments on commit fad95ea

Please sign in to comment.