"use client"; import React, { useState, useEffect, useRef } from "react"; import { Input } from "./ui/input"; import { Label } from "./ui/label"; import { Button } from "./ui/button"; import { CiSearch } from "react-icons/ci"; import { X, XCircle } from "lucide-react"; export default function Search({ mode, value, action, Cancel, changeValue, }: { mode?: string; value?: any; action?: (any: any) => any; Cancel: (any: any) => any; changeValue?: (any: any) => any; }) { const inputRef = useRef(null); const [cancel, setCancel] = useState(false); const handleSubmit = (e: any) => { console.log(222); e.preventDefault(); setCancel(true); }; const cancelSearch = (e: any) => { e.preventDefault(); setCancel(false); if (changeValue !== undefined) { console.log(444); changeValue(""); } Cancel(true); }; console.log(value); return (
{ if (changeValue) { setCancel(false); changeValue(e.target.value); } }} placeholder="جستجو..." /> {cancel ? ( ) : ( )} {/* */}
); }