|
|
@ -4,7 +4,17 @@ import { useAsyncDebounce } from "react-table"; |
|
|
|
import search from "./search-normal.svg"; |
|
|
|
import search from "./search-normal.svg"; |
|
|
|
import cancleIcon from "./zarbedar-icon.svg"; |
|
|
|
import cancleIcon from "./zarbedar-icon.svg"; |
|
|
|
|
|
|
|
|
|
|
|
export const GlobalFilter = ({ filter, setFilter }) => { |
|
|
|
export const GlobalFilter = ({ |
|
|
|
|
|
|
|
filter, |
|
|
|
|
|
|
|
setFilter, |
|
|
|
|
|
|
|
searchIcon, |
|
|
|
|
|
|
|
bgColor, |
|
|
|
|
|
|
|
borderColor, |
|
|
|
|
|
|
|
textColor, |
|
|
|
|
|
|
|
borderRadius, |
|
|
|
|
|
|
|
focusBorder, |
|
|
|
|
|
|
|
focusRing, |
|
|
|
|
|
|
|
}) => { |
|
|
|
const [activeSearchBox, setActiveSearchBox] = useState(false); |
|
|
|
const [activeSearchBox, setActiveSearchBox] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
const [value, setValue] = useState(filter); |
|
|
|
const [value, setValue] = useState(filter); |
|
|
@ -24,7 +34,7 @@ export const GlobalFilter = ({ filter, setFilter }) => { |
|
|
|
/> |
|
|
|
/> |
|
|
|
)} |
|
|
|
)} |
|
|
|
<img |
|
|
|
<img |
|
|
|
src={search} |
|
|
|
src={searchIcon} |
|
|
|
alt="" |
|
|
|
alt="" |
|
|
|
className="w-4 h-4 absolute left-2 cursor-pointer" |
|
|
|
className="w-4 h-4 absolute left-2 cursor-pointer" |
|
|
|
/> |
|
|
|
/> |
|
|
@ -34,70 +44,25 @@ export const GlobalFilter = ({ filter, setFilter }) => { |
|
|
|
onFocus={() => setActiveSearchBox(true)} |
|
|
|
onFocus={() => setActiveSearchBox(true)} |
|
|
|
// onBlur={() => setActiveSearchBox(false)}
|
|
|
|
// onBlur={() => setActiveSearchBox(false)}
|
|
|
|
type="text" |
|
|
|
type="text" |
|
|
|
className={`w-full text-xs text-blue-400 rounded focus:outline-none border focus:border-blue-200 focus:ring focus:ring-blue-200 focus:ring-opacity-20`} |
|
|
|
className={`w-full text-xs border focus:outline-none focus:ring focus:ring-opacity-20
|
|
|
|
style={{ backgroundColor: "#F9FBFF", borderColor: "#B5D6FF" }} |
|
|
|
${bgColor} |
|
|
|
|
|
|
|
${borderColor} |
|
|
|
|
|
|
|
${textColor} |
|
|
|
|
|
|
|
${borderRadius} |
|
|
|
|
|
|
|
${focusBorder} |
|
|
|
|
|
|
|
${focusRing} |
|
|
|
|
|
|
|
`}
|
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
GlobalFilter.defaultProps = { |
|
|
|
/* <input |
|
|
|
searchIcon: search, |
|
|
|
value={value || ""} |
|
|
|
bgColor: "bg-[#F9FBFF]", |
|
|
|
onChange={(e) => { |
|
|
|
borderColor: "border-[#B5D6FF]", |
|
|
|
setValue(e.target.value); |
|
|
|
textColor: "text-blue-400", |
|
|
|
onChange(e.target.value); |
|
|
|
borderRadius: "rounded", |
|
|
|
}} |
|
|
|
focusBorder: "focus:border-blue-200", |
|
|
|
onFocus={() => setActiveSearchBox(true)} |
|
|
|
focusRing: "focus:ring-blue-200", |
|
|
|
// onBlur={() => setActiveSearchBox(false)}
|
|
|
|
}; |
|
|
|
type="text" |
|
|
|
|
|
|
|
className={`text-xs text-blue-400 rounded focus:outline-none placeholder-blue-400 border`} |
|
|
|
|
|
|
|
style={{ backgroundColor: "#F9FBFF", borderColor: "#B5D6FF" }} |
|
|
|
|
|
|
|
/> */ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ? اگر میخواستم کاری کنم که وقتی رویه سرچ باکس میزدم ایکن ضربدر هاید میشد و ایکن کنسل میومد باید از این کد استفاده میکردم
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// import React, { useState } from "react";
|
|
|
|
|
|
|
|
// import { useAsyncDebounce } from "react-table";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// import search from "./search-normal.svg";
|
|
|
|
|
|
|
|
// import cancleIcon from "./zarbedar-icon.svg";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// export const GlobalFilter = ({ filter, setFilter }) => {
|
|
|
|
|
|
|
|
// const [activeSearchBox, setActiveSearchBox] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const [value, setValue] = useState(filter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const onChange = useAsyncDebounce((value) => {
|
|
|
|
|
|
|
|
// setFilter(value || undefined);
|
|
|
|
|
|
|
|
// }, 400);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return (
|
|
|
|
|
|
|
|
// <div className="flex flex-row-reverse items-center relative ml-2 ">
|
|
|
|
|
|
|
|
// {activeSearchBox === true ? (
|
|
|
|
|
|
|
|
// <img
|
|
|
|
|
|
|
|
// src={cancleIcon}
|
|
|
|
|
|
|
|
// alt=""
|
|
|
|
|
|
|
|
// className="w-3 h-3 absolute left-2 cursor-pointer"
|
|
|
|
|
|
|
|
// />
|
|
|
|
|
|
|
|
// ) : (
|
|
|
|
|
|
|
|
// <img
|
|
|
|
|
|
|
|
// src={search}
|
|
|
|
|
|
|
|
// alt=""
|
|
|
|
|
|
|
|
// className="w-4 h-4 absolute left-2 cursor-pointer"
|
|
|
|
|
|
|
|
// />
|
|
|
|
|
|
|
|
// )}
|
|
|
|
|
|
|
|
// <input
|
|
|
|
|
|
|
|
// value={filter || ""}
|
|
|
|
|
|
|
|
// onChange={(e) => setFilter(e.target.value)}
|
|
|
|
|
|
|
|
// onFocus={() => setActiveSearchBox(true)}
|
|
|
|
|
|
|
|
// onBlur={() => setActiveSearchBox(false)}
|
|
|
|
|
|
|
|
// type="text"
|
|
|
|
|
|
|
|
// className={`text-xs text-blue-400 rounded focus:outline-none border focus:border-blue-200 focus:ring focus:ring-blue-200 focus:ring-opacity-20`}
|
|
|
|
|
|
|
|
// style={{ backgroundColor: "#F9FBFF", borderColor: "#B5D6FF" }}
|
|
|
|
|
|
|
|
// />
|
|
|
|
|
|
|
|
// {console.log(activeSearchBox)}{" "}
|
|
|
|
|
|
|
|
// </div>
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|