implement events props

This commit is contained in:
SrGooglo 2022-11-24 14:26:07 +00:00
parent 4c901e0e13
commit d5268477e8

View File

@ -131,6 +131,16 @@ export default (props) => {
setLoading(false) setLoading(false)
}, 400) }, 400)
if (searchValue === "") {
if (typeof props.onEmpty === "function") {
props.onEmpty()
}
} else {
if (typeof props.onFilled === "function") {
props.onFilled()
}
}
return () => clearTimeout(timer) return () => clearTimeout(timer)
}, [searchValue]) }, [searchValue])
@ -142,7 +152,9 @@ export default (props) => {
onChange={handleOnSearch} onChange={handleOnSearch}
value={searchValue} value={searchValue}
prefix={<Icons.Search />} prefix={<Icons.Search />}
autoFocus autoFocus={props.autoFocus ?? false}
onFocus={props.onFocus}
onBlur={props.onUnfocus}
/> />
{searchResult && <div className="results"> {searchResult && <div className="results">