diff --git a/src/components/table-toolbar/PaginatingTableToolbar.tsx b/src/components/table-toolbar/PaginatingTableToolbar.tsx index 5d191aa8a1..a81f3d07f8 100644 --- a/src/components/table-toolbar/PaginatingTableToolbar.tsx +++ b/src/components/table-toolbar/PaginatingTableToolbar.tsx @@ -1,4 +1,4 @@ -import React, { FormEvent, FunctionComponent, ReactNode } from "react"; +import React, { FunctionComponent, ReactNode } from "react"; import { Pagination, ToggleTemplateProps, @@ -18,10 +18,6 @@ type TableToolbarProps = { subToolbar?: ReactNode; inputGroupName?: string; inputGroupPlaceholder?: string; - inputGroupOnChange?: ( - newInput: string, - event: FormEvent - ) => void; inputGroupOnEnter?: (value: string) => void; }; @@ -38,7 +34,6 @@ export const PaginatingTableToolbar: FunctionComponent = ({ children, inputGroupName, inputGroupPlaceholder, - inputGroupOnChange, inputGroupOnEnter, }) => { const page = Math.round(first / max); @@ -77,7 +72,6 @@ export const PaginatingTableToolbar: FunctionComponent = ({ } inputGroupName={inputGroupName} inputGroupPlaceholder={inputGroupPlaceholder} - inputGroupOnChange={inputGroupOnChange} inputGroupOnEnter={inputGroupOnEnter} > {children} diff --git a/src/components/table-toolbar/TableToolbar.tsx b/src/components/table-toolbar/TableToolbar.tsx index 79347f2605..157bc97d6a 100644 --- a/src/components/table-toolbar/TableToolbar.tsx +++ b/src/components/table-toolbar/TableToolbar.tsx @@ -1,5 +1,4 @@ import React, { - FormEvent, FunctionComponent, ReactNode, useState, @@ -10,12 +9,9 @@ import { ToolbarContent, ToolbarItem, InputGroup, - TextInput, - Button, - ButtonVariant, Divider, + SearchInput, } from "@patternfly/react-core"; -import { SearchIcon } from "@patternfly/react-icons"; import { useTranslation } from "react-i18next"; type TableToolbarProps = { @@ -25,10 +21,6 @@ type TableToolbarProps = { searchTypeComponent?: ReactNode; inputGroupName?: string; inputGroupPlaceholder?: string; - inputGroupOnChange?: ( - newInput: string, - event: FormEvent - ) => void; inputGroupOnEnter?: (value: string) => void; }; @@ -40,7 +32,6 @@ export const TableToolbar: FunctionComponent = ({ searchTypeComponent, inputGroupName, inputGroupPlaceholder, - inputGroupOnChange, inputGroupOnEnter, }) => { const { t } = useTranslation(); @@ -62,14 +53,6 @@ export const TableToolbar: FunctionComponent = ({ } }; - const handleInputChange = ( - value: string, - event: FormEvent - ) => { - inputGroupOnChange?.(value, event); - setSearchValue(value); - }; - return ( <> @@ -79,24 +62,18 @@ export const TableToolbar: FunctionComponent = ({ {searchTypeComponent} {inputGroupPlaceholder && ( - <> - - - + { + setSearchValue(""); + inputGroupOnEnter?.(""); + }} + /> )}