All files / src/components/common/BasicSearch index.tsx

0% Statements 0/4
0% Branches 0/4
0% Functions 0/2
0% Lines 0/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                                                         
import { CloseRounded, SearchRounded } from "@mui/icons-material";
import React from "react";
 
function BasicSearch({
  query,
  setValue,
  placeholder = "Search by name or type...",
  inputClassName = "",
}) {
  return (
    <div className="flex items-center bg-white w-full p-2 gap-2 border rounded">
      <SearchRounded fontSize="small" />
      <input
        className={`${inputClassName} w-full h-full text-base outline-none`}
        placeholder={placeholder}
        value={query}
        onChange={setValue}
      />
      {query && (
        <div onClick={() => setValue()} className="cursor-pointer">
          <CloseRounded fontSize="small" />
        </div>
      )}
    </div>
  );
}
 
export default BasicSearch;