File tree Expand file tree Collapse file tree 3 files changed +29
-7
lines changed
Expand file tree Collapse file tree 3 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,15 @@ class DefaultSectionHeader extends React.Component {
3939
4040 render ( ) {
4141 return (
42- < div className = "slds-lookup__item"
42+ < li className = "slds-lookup__item"
4343 tabIndex = "-1"
4444 >
45- @@@ Section
46- </ div >
45+ < a href = "javascript:void()" tabIndex = "-1" >
46+ < span className = "slds-m-left--x-small" >
47+ < strong > { this . props . data . label } </ strong >
48+ </ span >
49+ </ a >
50+ </ li >
4751 )
4852 }
4953}
Original file line number Diff line number Diff line change @@ -59,7 +59,25 @@ class Menu extends React.Component {
5959 }
6060
6161 filteredItems ( ) {
62- return this . props . items . filter ( this . filter , this )
62+ return this . filterEmptySections ( this . props . items . filter ( this . filter , this ) ) ;
63+ }
64+
65+ filterEmptySections ( items ) {
66+ const result = [ ] ;
67+ items . forEach ( ( item , index ) => {
68+ if ( item && item . data && item . data . type === 'section' ) {
69+ if ( index + 1 < items . length ) {
70+ const nextItem = items [ index + 1 ] ;
71+ if ( nextItem . data && nextItem . data . type !== 'section' ) {
72+ result . push ( item ) ;
73+ }
74+ }
75+ }
76+ else {
77+ result . push ( item ) ;
78+ }
79+ } ) ;
80+ return result ;
6381 }
6482
6583 //Scroll menu up/down when using mouse keys
Original file line number Diff line number Diff line change @@ -20,14 +20,14 @@ module.exports = React.createClass({
2020 onChange = { function ( newValue ) { console . log ( "New search term: " , newValue ) } }
2121 onSelect = { function ( item ) { console . log ( item , " Selected" ) } }
2222 options = { [
23- { type :'section' , label :'Section 1' } ,
23+ { type :'section' , label :'SECTION 1' } ,
2424 { label : "Paddy\"s Pub" } ,
2525 { label : "Tyrell Corp" } ,
26- { type :'section' , label :'Section 2' } ,
26+ { type :'section' , label :'SECTION 2' } ,
2727 { label : "Paper St. Soap Company" } ,
2828 { label : "Nakatomi Investments" } ,
2929 { label : "Acme Landscaping" } ,
30- { type :'section' , label :'Section 3' } ,
30+ { type :'section' , label :'SECTION 3' } ,
3131 { label : "Acme Construction" }
3232 ] }
3333 />
You can’t perform that action at this time.
0 commit comments