Sha256: 7ed9ceae74318d03d0346c892597c7be4e8cbe0d17875c4d54b906fb4021a1a8
Contents?: true
Size: 1.38 KB
Versions: 19
Compression:
Stored size: 1.38 KB
Contents
/* eslint-disable react-hooks/exhaustive-deps */ import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; import { FormGroup, TextInput } from '@patternfly/react-core'; import { noop } from 'foremanReact/common/helpers'; import { translate as __ } from 'foremanReact/common/I18n'; import ClearButton from './Components/ClearButton'; import './inventoryFilter.scss'; import { ANY_ORGANIZATION } from './InventoryFilterConstants'; const InventoryFilter = ({ handleFilterChange, handleFilterClear, filterTerm, organization, }) => { useEffect(() => { const initialTerm = organization === __(ANY_ORGANIZATION) ? '' : organization; handleFilterChange(initialTerm); }, []); return ( <form id="inventory_filter_form"> <FormGroup> <TextInput id="inventory_filter_input" value={filterTerm} type="text" placeholder={__('Filter..')} onChange={handleFilterChange} /> <ClearButton onClear={handleFilterClear} /> </FormGroup> </form> ); }; InventoryFilter.propTypes = { handleFilterChange: PropTypes.func, handleFilterClear: PropTypes.func, filterTerm: PropTypes.string, organization: PropTypes.string, }; InventoryFilter.defaultProps = { handleFilterChange: noop, handleFilterClear: noop, filterTerm: '', organization: '', }; export default InventoryFilter;
Version data entries
19 entries across 19 versions & 1 rubygems