import Router from 'next/router' import { useState, useEffect } from 'react' export default (props:{ defaultValue?:string, on?:(string)=>void, mainpage?:boolean, title?:string, lbtntext?:string, onplus?:()=>void, lefticon?:any, lefticondisable?:boolean, placeholder?:string, onbtnl?:()=>void,onlefticon?:()=>void, }) => { var [clicked, setClicked] = useState(false) useEffect(() => { if (!props.defaultValue && !Router.query.s && (document.getElementById("searchinput") as HTMLInputElement).value) { (document.getElementById("searchinput") as HTMLInputElement).value = "" } }) var onsearch = (txt) => { if (props.on) { props.on(txt) } else { if (props.mainpage) { Router.push(global.root + "/" + txt) } else { if (txt == "") { delete Router.query.s Router.push({ pathname: Router.pathname, query: Router.query }) } else { Router.query.s = txt Router.push({ pathname: Router.pathname, query: Router.query }) } } } } return