import React from 'react'; import {useState} from "react"; import {CircularProgress, Container, IconButton, InputAdornment, TextField} from "@mui/material"; import Typography from "@mui/material/Typography"; import SearchIcon from "@material-ui/icons/Search"; import {NotFound} from "../GoodsTab/NotFound"; import {connect} from "react-redux"; import {actionSearchRemove} from "../../../reducers/SearchReducer"; import {actionFullSearchCategory} from "../../../actions/ActionCategory"; import {CategoryFound} from "./CategoryFound"; const FindCategoryEdit = ({searchResult, onSearch, onSearchRemove}) => { const [value, setValue] = useState('') const [click, setClick] = useState(false) return ( <> WHICH ITEM TO EDIT? { setClick(false); setValue(event.target.value); onSearchRemove() }} InputProps={{ sx: { padding: '10px', outline:'none', color: '#616161', fontWeight: '300', letterSpacing: '1px', marginBottom: '50px' }, endAdornment: ( { setClick(true); onSearchRemove(); onSearch(value) }} > ) }} /> {(value !== '' && click) && (searchResult?.searchResult ? Object.values(searchResult.searchResult).length > 0 ? Object.values(searchResult.searchResult) .map(item => ) : : )} ) } export const CFindCategoryEdit = connect(state=> ({ searchResult: state.search}), { onSearch: actionFullSearchCategory, onSearchRemove: actionSearchRemove}) (FindCategoryEdit)