@@ -132,34 +132,35 @@ export class SearchForm extends React.Component {
132
132
< input className = "FormInput" type = "text" value = { location } onChange = { this . handleLocationChange } placeholder = "File Path (absolute)" />
133
133
</ div >
134
134
< div className = "ResultsContainer" >
135
- < div className = "Summary" >
136
- {
137
- ( searchString === '' && location === '' ) ?
138
- < span > Type in the searchbox to get started! </ span > :
135
+ {
136
+ ( searchString !== '' || location !== '' ) ?
137
+ < div className = "Summary" >
139
138
< span >
140
139
Search results for string < code > { searchString === '' ? '' : `'${ searchString } '` } </ code > at < code > { location === '' ? 'any path' : `'${ location } '` } </ code >
141
140
</ span >
142
- }
143
- </ div >
141
+ </ div > : null
142
+ }
144
143
< div className = "Results" ref = { ( ref ) => this . resultView = this . resultView || ref } >
145
- < ConnectedInfiniteScroll loadMore = { ( ) => this . loadMore ( hashes ) } hasMore = { searchString || location } >
146
- {
147
- results . map ( ( result , i ) => {
148
- var { file, lno, above_lines, the_line, below_lines} = result ;
149
- var code = above_lines . concat ( the_line , below_lines ) ;
150
- return (
151
- < ConnectedCodeView
152
- key = { i }
153
- filePath = { file }
154
- content = { code . join ( '\n' ) + '\n' }
155
- length = { code . length }
156
- start = { lno - 3 }
157
- lno = { lno }
158
- />
159
- ) ;
160
- } )
161
- }
162
- </ ConnectedInfiniteScroll >
144
+ { ( results . length > 0 ) ?
145
+ < ConnectedInfiniteScroll loadMore = { ( ) => this . loadMore ( hashes ) } hasMore = { searchString || location } >
146
+ {
147
+ results . map ( ( result , i ) => {
148
+ var { file, lno, above_lines, the_line, below_lines} = result ;
149
+ var code = above_lines . concat ( the_line , below_lines ) ;
150
+ return (
151
+ < ConnectedCodeView
152
+ key = { i }
153
+ filePath = { file }
154
+ content = { code . join ( '\n' ) + '\n' }
155
+ length = { code . length }
156
+ start = { lno - 3 }
157
+ lno = { lno }
158
+ />
159
+ ) ;
160
+ } )
161
+ }
162
+ </ ConnectedInfiniteScroll > : < div className = "Empty" > Type something to get started!</ div >
163
+ }
163
164
</ div >
164
165
</ div >
165
166
< div className = "Footer" >
0 commit comments