text: import React, { useState } from "react";
  import { TextField } from "@material-ui/core";
  
  const Search = ({ dataItems, setItems }) => {
    const [searchText, setSearchText] = useState("");
  
    const MyColumns = ["id"];
    const handleChange = (value) => {
      setSearchText(value);
      filterData(value);
    };
    const filterData = (value) => {
      const lowercasedValue = value.toLowerCase().trim();
      if (!searchText) return;
      //  console.log(lowercasedValue === "")
      if (lowercasedValue === "") setItems(dataItems);
      else {
        const filteredData = dataItems.filter((item) => {
          return Object.keys(item).some((key) =>
            MyColumns.includes(key)
              ? false
              : item[key].toString().toLowerCase().includes(lowercasedValue)
          );
        });
        setItems(filteredData);
      }
    };
    return (
      <TextField
        size="small"
        placeholder="جستجو"
        value={searchText}
        onChange={(e) => handleChange(e.target.value)}
        variant="outlined"
        style={{ width: "30%", marginBottom: "8px" }}
      />
    );
  };
  
  export default Search;
  