отображение результатов поиска
This commit is contained in:
@ -1,19 +1,22 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
export default class Search extends Component {
|
||||
componentDidMount() {
|
||||
import SearchResults from './search-results'
|
||||
|
||||
}
|
||||
export default class Search extends Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="row">
|
||||
<input type='text' ref='searchInput' onKeyPress={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
window.torrentSocket.emit('search', e.target.value, (torrents) => {
|
||||
console.log(torrents);
|
||||
});
|
||||
}
|
||||
}} />
|
||||
<div className="column">
|
||||
<div className='row'>
|
||||
<input type='text' ref='searchInput' onKeyPress={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
window.torrentSocket.emit('search', e.target.value, (torrents) => {
|
||||
this.searchData = torrents;
|
||||
this.forceUpdate();
|
||||
});
|
||||
}
|
||||
}} />
|
||||
</div>
|
||||
<SearchResults results={this.searchData} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user