import React, { FormEvent, Fragment, MouseEventHandler, ReactNode, } from "react"; import { Toolbar, ToolbarContent, ToolbarItem, InputGroup, TextInput, Button, ButtonVariant, Divider, } from "@patternfly/react-core"; import { SearchIcon } from "@patternfly/react-icons"; import { useTranslation } from "react-i18next"; type TableToolbarProps = { toolbarItem?: ReactNode; toolbarItemFooter?: ReactNode; children: ReactNode; searchTypeComponent?: ReactNode; inputGroupName?: string; inputGroupPlaceholder?: string; inputGroupOnChange?: ( newInput: string, event: FormEvent ) => void; inputGroupOnClick?: MouseEventHandler; }; export const TableToolbar = ({ toolbarItem, toolbarItemFooter, children, searchTypeComponent, inputGroupName, inputGroupPlaceholder, inputGroupOnChange, inputGroupOnClick, }: TableToolbarProps) => { const { t } = useTranslation(); return ( <> {inputGroupName && ( {searchTypeComponent} {inputGroupPlaceholder && ( <> )} )} {toolbarItem} {children} {toolbarItemFooter} ); };