Commit c651d2b7 authored by Maxime POULAIN's avatar Maxime POULAIN
Browse files

disable search when not in home page

parent 6d00b000
import { Link } from "react-router-dom";
import { useLocation } from 'react-router-dom'
import 'bootstrap/dist/css/bootstrap.css'
......@@ -32,6 +33,8 @@ const navItems = menus.map(menu => {
export const Header = ({ onSearchChange }) => {
const location = useLocation().pathname;
const searchDisabled = location !== "/home";
return (
<nav className="navbar navbar-expand-md navbar-light bg-transparent">
<Link to="home" className="nav-link active" style={{ color: 'inherit', textDecoration: 'inherit' }}>
......@@ -39,7 +42,7 @@ export const Header = ({ onSearchChange }) => {
</Link>
<form className="form-inline my-2 my-lg-0 ml-5">
<input className="form-control mr-sm-2" type="search" placeholder="Search" onChange={(event) => onSearchChange(event.target.value)} />
<input className="form-control mr-sm-2" type="search" placeholder="Search" onChange={(event) => onSearchChange(event.target.value)} disabled={searchDisabled} />
</form>
<ul className="navbar-nav flex-grow-1 d-flex flex-row justify-content-end mx-5 mb-2">
{navItems}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment