11import React , { useState } from "react" ;
2- import { MdSearch } from "react-icons/md" ;
2+ import { MdSearch , MdClear } from "react-icons/md" ;
33import './css/style.css'
44const errorType = [ "push" , "commit" , "merge" , "pull" , "add" , "branch" ]
55import useWindowsize from "../../hooks/useWindowsize" ;
@@ -16,13 +16,16 @@ function SearchInput({ search, setSearch, setType }) {
1616 >
1717 < MdSearch className = "text-gray text-2xl" />
1818 < input
19- type = "search "
19+ type = "text "
2020 id = "searchbox"
2121 value = { search }
2222 className = "w-full text-sm md:text-base focus:outline-none placholder:font-semibold text-dark bg-transparent"
2323 placeholder = "Search for errors"
2424 onChange = { ( e ) => { setSearch ( e . target . value ) ; setType ( "" ) } }
2525 />
26+ < button className = { `focus:outline-none ${ ! search ? "hidden" : "block" } ` } onClick = { ( ) => setSearch ( "" ) } >
27+ < MdClear className = "text-gray text-xl" />
28+ </ button >
2629 </ form >
2730 < div className = "types mt-4" >
2831
@@ -33,7 +36,7 @@ function SearchInput({ search, setSearch, setType }) {
3336 errorType . map ( ( item , i ) => (
3437 < li
3538 key = { i }
36- className = { `${ item === "add" ? "bg-[#4024e0]" : item === "commit" ? "bg-[#1a5ba5]" : item === "merge" ? "bg-[#118d7c]" : item === "push" ? "bg-[#8d54e1]" : item === "branch" ? "bg-[#40E4F0]" : "bg-[#7e1aa5]"
39+ className = { `${ item === "add" ? "bg-[#4024e0]" : item === "commit" ? "bg-[#1a5ba5]" : item === "merge" ? "bg-[#118d7c]" : item === "push" ? "bg-[#8d54e1]" : item === "branch" ? "bg-[#40E4F0]" : "bg-[#7e1aa5]"
3740 }
3841 w-full md:w-auto rounded-md text-white font-bold py-1 px-3 cursor-pointer` }
3942 onClick = { ( ) => setType ( item ) }
0 commit comments