diff --git a/src/Components/Search.jsx b/src/Components/Search.jsx index a8bfead..06e3433 100644 --- a/src/Components/Search.jsx +++ b/src/Components/Search.jsx @@ -1,4 +1,4 @@ -import React, {useState} from 'react'; +import React, {useEffect, useState} from 'react'; import { subMenusList } from '../Constants'; import {CiSearch } from "react-icons/ci"; import { AiOutlineDoubleRight } from "react-icons/ai"; @@ -6,6 +6,7 @@ import { NavLink } from 'react-router-dom'; const Search = () => { const [searchInput, setSearchInput] = useState(""); + const [isSearchBarOpen, setIsSearchBarOpen] = useState(false); const handleChange = (e) => { e.preventDefault(); setSearchInput(e.target.value); @@ -13,7 +14,17 @@ const Search = () => { const filteredContent = subMenusList.filter(menu => { const content = menu.title.toLowerCase(); return content.includes(searchInput.toLowerCase()); - }) + }); + + const selectOption = (name) => { + setSearchInput(name); + setIsSearchBarOpen(false) + }; + + // useEffect(() => { + // setSearchInput(""); + // },[selectOption]) + return ( <>