Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
888 B
1
Indexable
Never
import { useState } from "react";
import { FaRegEye, FaRegEyeSlash } from "react-icons/fa";

export default function PasswordFild({ password, handleChange }) {

    const [passwordType, setPasswordType] = useState(false)
    const handlePasswordShow = async (e) => {
        setPasswordType(!passwordType)
    };
    return (
        <div className="flex">
            <input
                type={passwordType ? "text" : "password"}
                className="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm "
                placeholder="Enter password"
                name="password"
                value={password}
                onChange={handleChange}

            />
            <p className=" cursor-pointer -ml-8 mt-5" onClick={() =>
                handlePasswordShow()
            }>{passwordType ? <FaRegEyeSlash /> : <FaRegEye />}</p>
        </div>
    )
}
Leave a Comment