import { Paper, TextField, Stack, Popper, Avatar, Typography, Card, InputAdornment } from "@mui/material"; import SearchIcon from "@mui/icons-material/Search"; import React from "react"; export default class Content extends React.Component { constructor(props) { super(props); this.state = { searchtext:'', result:[], anchorEl:null }; } handleSearch = (searchtext) => { if(searchtext.trim().length > 2){ this.props.socket.emit('search',searchtext,(err,res)=>{ if(!err){ this.setState({ result:res }); console.log(res); } else{ console.log('Err',err); this.setState({ result:[] }); } }); } else{ this.setState({ result:[] }); } } render() { return (
) }} value={this.state.searchtext} inputRef={(input) => {input && input.focus()}} onChange={(e) => { this.setState({ anchorEl:e.target,searchtext: e.target.value }); this.handleSearch(e.target.value); }} autoComplete="off" fullWidth /> 0} anchorEl={this.state.anchorEl} placement={'bottom-start'} > {this.state.result.map((line,i)=>( { window.location = 'https://t.growheads.de/'+line.cSeo }}> {line.cName} ))}
); } }