import Router from 'next/router' import VItem from './VItem' import Text from './Text' import { useState } from 'react' import Cap from './Cap' export default (props:{ id:string, placeholder?:string, query:{cat:any, sort:any}, onsearch?:(string)=>void title:string,defaultValue?:string, squery:string, }) => { var isopen = props.query.cat || props.query.sort var [cat, setCat] = useState(props.query.cat) var [sort, setSort] = useState(props.query.sort); var prevtext = "" var iso = false; if (typeof window != "undefined") { var body = document.getElementById("search_options_" + props.id); if (body?.style?.maxHeight && body?.style?.maxHeight != "0px") { iso = true; } } var toggle = () => { var e = document.getElementById('smenu'); var body = document.getElementById("search_options_" + props.id); if (body.style.maxHeight == "0px") { body.style.transition = "max-height 0.5s ease"; body.style.maxHeight = "2000px"; body.style.marginTop = "4px"; e.style.opacity = "1" } else { e.style.opacity = isopen ? "1" : "0.3" body.style.marginTop = "0px"; body.style.transition = "all 0.2s cubic-bezier(0, 1, 0, 1)"; body.style.maxHeight = "0px"; } } return <>