Skip to content

Commit

Permalink
fix(search): fix onsearch func
Browse files Browse the repository at this point in the history
Signed-off-by: Sudhanshu Dasgupta <[email protected]>
  • Loading branch information
sudhanshutech committed Nov 11, 2023
1 parent a8738e6 commit c6d6e27
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/components/src/custom/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export interface SearchBarProps {
setExpanded: (expanded: boolean) => void;
}

function SearchBar({ placeholder, onClear, expanded, setExpanded }: SearchBarProps): JSX.Element {
function SearchBar({
onSearch,
placeholder,
onClear,
expanded,
setExpanded
}: SearchBarProps): JSX.Element {
const [searchText, setSearchText] = React.useState('');
const searchRef = React.useRef<HTMLInputElement | null>(null);

Expand Down Expand Up @@ -48,7 +54,10 @@ function SearchBar({ placeholder, onClear, expanded, setExpanded }: SearchBarPro
<TextField
variant="standard"
value={searchText}
onChange={handleSearchChange}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
handleSearchChange(e);
onSearch(e.target.value);
}}
inputRef={searchRef}
placeholder={placeholder}
style={{
Expand Down

0 comments on commit c6d6e27

Please sign in to comment.