Skip to content

Commit 53d5943

Browse files
committed
Add in fixed top and bottom 'Search in ..' and 'Add item' buttons inside lookup component
1 parent d90e322 commit 53d5943

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

components/SLDSLookup/Menu/index.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,21 @@ class Menu extends React.Component {
4848
});
4949
}
5050

51-
renderEmptyState(){
52-
let className = 'slds-lookup__item';
53-
return (
54-
<li
55-
className={className}
56-
role="presentaion">
57-
<a
58-
href='#'
59-
id='add-item'
60-
tabIndex="-1"
61-
role="option"
62-
onClick={this.props.addItem}
63-
onMouseDown={this.props.addItem}>
51+
renderSearchDetails(){
52+
return(
53+
<button className="slds-button">
54+
<Icon name="search" category="utility" size="x-small" className="slds-icon-text-default" />
55+
{this.props.searchTerm ? '"' + this.props.searchTerm + '"' : ""} in {this.props.type}
56+
</button>
57+
);
58+
}
59+
60+
renderAddItem(){
61+
return(
62+
<button className="slds-button" onClick={this.props.addItem} onMouseDown={this.props.addItem}>
6463
<Icon name="add" category="utility" size="x-small" className="slds-icon-text-default" />
6564
New {this.props.type}
66-
</a>
67-
</li>
65+
</button>
6866
);
6967
}
7068

@@ -74,12 +72,17 @@ class Menu extends React.Component {
7472
className="ignore-react-onclickoutside slds-lookup__menu"
7573
role="listbox"
7674
ref="scroll">
77-
<ul className="slds-lookup__list"
78-
role="presentation"
79-
ref="list">
80-
{this.renderItems()}
81-
{this.renderEmptyState()}
82-
</ul>
75+
<div className="slds-lookup__item">
76+
{this.renderSearchDetails()}
77+
</div>
78+
<ul className="slds-lookup__list"
79+
role="presentation"
80+
ref="list">
81+
{this.renderItems()}
82+
</ul>
83+
<div className="slds-lookup__item">
84+
{this.renderAddItem()}
85+
</div>
8386
</div>
8487
)
8588
}

0 commit comments

Comments
 (0)