import * as React from 'react'; import { observer } from 'mobx-react'; import { observable, action } from 'mobx'; import { Utils } from '../../Utils'; import { MessageStore } from '../../server/Message'; import { Server } from '../Server'; import "./SearchBox.scss"; import { faSearch } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { library } from '@fortawesome/fontawesome-svg-core'; import { actionFieldDecorator } from 'mobx/lib/internal'; // const app = express(); // import * as express from 'express'; import { Search } from '../../server/Search'; library.add(faSearch); @observer export class SearchBox extends React.Component { @observable searchString: string = ""; @observable private _open: boolean = false; @action.bound onChange(e: React.ChangeEvent) { this.searchString = e.target.value; } submitSearch = () => { // Utils.EmitCallback(Server.Socket, MessageStore.SearchFor, this.searchString, (results: string[]) => { // for (const result of results) { // console.log(result); // //Utils.GetQueryVariable(); // } // }); let query = this.searchString; console.log(query); //something bad is happening here let results = Search.Instance.search(query); console.log(results); // app.get("/search", async (req, res) => { // //let query = req.query.query || "hello"; // let query = this.searchString; // let results = await Search.Instance.search(query); // res.send(results); // }); } @action handleClick = (e: Event): void => { var className = (e.target as any).className; var id = (e.target as any).id; console.log(id); //let imgPrev = document.getElementById("img_preview"); console.log(className); if (className !== "filter-button" && className !== "filter-form") { console.log("false"); this._open = false; } } componentWillMount() { document.addEventListener('mousedown', this.handleClick, false); } componentWillUnmount() { document.removeEventListener('mousedown', this.handleClick, false); } @action toggleDisplay = () => { this._open = !this._open; } render() { return (
{/*
filter by collection, key, type of node
); } }