import { Component, linkEvent } from 'inferno'; import { SearchParams } from '../interfaces'; interface State { searchParams: SearchParams; } export class Navbar extends Component { state: State = { searchParams: { page: 1, q: "" } } constructor(props, context) { super(props, context); } render() { return (
{this.navbar()}
) } navbar() { return ( ); } // TODO // https://www.codeply.com/go/xBVaM3q5X4/bootstrap-4-navbar-search-full-width searchForm() { return (
); } search(i: Navbar, event) { event.preventDefault(); i.context.router.history.push(`/search/${i.state.searchParams.q}/${i.state.searchParams.page}`); } searchChange(i: Navbar, event) { let searchParams: SearchParams = { q: event.target.value, page: 1 } i.setState({ searchParams: searchParams }); } }