базовый поиск
This commit is contained in:
@ -5,12 +5,14 @@ var io = require("socket.io-client");
|
||||
window.torrentSocket = io('http://localhost:8099/');
|
||||
|
||||
import RecentTorrents from './recent-torrents'
|
||||
import Search from './search'
|
||||
|
||||
class App extends Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="App">
|
||||
<RecentTorrents />
|
||||
<Search />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
20
src/search.js
Normal file
20
src/search.js
Normal file
@ -0,0 +1,20 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
export default class Search extends Component {
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
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>
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user