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 {
39
39
40
40
render ( ) {
41
41
return (
42
- < div className = "slds-lookup__item"
42
+ < li className = "slds-lookup__item"
43
43
tabIndex = "-1"
44
44
>
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 >
47
51
)
48
52
}
49
53
}
Original file line number Diff line number Diff line change @@ -59,7 +59,25 @@ class Menu extends React.Component {
59
59
}
60
60
61
61
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 ;
63
81
}
64
82
65
83
//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({
20
20
onChange = { function ( newValue ) { console . log ( "New search term: " , newValue ) } }
21
21
onSelect = { function ( item ) { console . log ( item , " Selected" ) } }
22
22
options = { [
23
- { type :'section' , label :'Section 1' } ,
23
+ { type :'section' , label :'SECTION 1' } ,
24
24
{ label : "Paddy\"s Pub" } ,
25
25
{ label : "Tyrell Corp" } ,
26
- { type :'section' , label :'Section 2' } ,
26
+ { type :'section' , label :'SECTION 2' } ,
27
27
{ label : "Paper St. Soap Company" } ,
28
28
{ label : "Nakatomi Investments" } ,
29
29
{ label : "Acme Landscaping" } ,
30
- { type :'section' , label :'Section 3' } ,
30
+ { type :'section' , label :'SECTION 3' } ,
31
31
{ label : "Acme Construction" }
32
32
] }
33
33
/>
You can’t perform that action at this time.
0 commit comments