From 57ecc2ef878affad104c3df11c0f7e3829a5f8cd Mon Sep 17 00:00:00 2001 From: Wind-Explorer Date: Fri, 28 Jun 2024 08:51:04 +0800 Subject: [PATCH] Added show password button for password fields --- client/src/components/NextUIFormikInput.tsx | 18 +++++++++ client/src/icons.tsx | 43 +++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/client/src/components/NextUIFormikInput.tsx b/client/src/components/NextUIFormikInput.tsx index cc670ee..97bd714 100644 --- a/client/src/components/NextUIFormikInput.tsx +++ b/client/src/components/NextUIFormikInput.tsx @@ -1,5 +1,7 @@ import { Input } from "@nextui-org/react"; import { useField } from "formik"; +import { useState } from "react"; +import { EyeIcon, EyeSlashIcon } from "../icons"; interface NextUIFormikInputProps { label: string; @@ -16,15 +18,31 @@ const NextUIFormikInput = ({ ...props }: NextUIFormikInputProps) => { const [field, meta] = useField(props.name); + const [inputType, setInputType] = useState(props.type); return ( + + + ) : null + } /> ); }; diff --git a/client/src/icons.tsx b/client/src/icons.tsx index cb12019..1ed7fb3 100644 --- a/client/src/icons.tsx +++ b/client/src/icons.tsx @@ -54,3 +54,46 @@ export const LockClosedIcon = () => { ); }; + +export const EyeSlashIcon = () => { + return ( + + + + ); +}; + +export const EyeIcon = () => { + return ( + + + + + ); +};