From 5f796368ac90cfa33342d1e2dfd6360a0d0cce7b Mon Sep 17 00:00:00 2001 From: CodeAunt Date: Tue, 2 May 2023 15:05:08 +0800 Subject: [PATCH] add view button for password input field --- .../src/components/inputComponent/index.tsx | 50 ++++++++++++++++--- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 6f76f6773..164d00704 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -9,6 +9,7 @@ export default function InputComponent({ password, }: InputComponentType) { const [myValue, setMyValue] = useState(value ?? ""); + const [pwdVisable, setPwdVisable] = useState(false) useEffect(() => { if (disabled) { setMyValue(""); @@ -16,24 +17,61 @@ export default function InputComponent({ } }, [disabled, onChange]); return ( -
+
0?"password":"" )} placeholder="Type a text" - onCopy={(e)=>{ - if(password) e.preventDefault(); - }} onChange={(e) => { setMyValue(e.target.value); onChange(e.target.value); }} /> +
); }