From 51c9f182799ac2c828e6561f2c0c5b3d1a826422 Mon Sep 17 00:00:00 2001
From: MathieuG-P <40181755+Zagrios@users.noreply.github.com>
Date: Sun, 11 Jun 2023 17:40:06 +0200
Subject: [PATCH] [feature] add show password button
---
.../modal/modal-types/login-modal.component.tsx | 8 ++++++--
src/renderer/components/svgs/bsm-icon.component.tsx | 4 +++-
.../components/svgs/icons/eye-cross-icon.component.tsx | 9 +++++++++
3 files changed, 18 insertions(+), 3 deletions(-)
create mode 100644 src/renderer/components/svgs/icons/eye-cross-icon.component.tsx
diff --git a/src/renderer/components/modal/modal-types/login-modal.component.tsx b/src/renderer/components/modal/modal-types/login-modal.component.tsx
index 74bb33ab..f7b29366 100644
--- a/src/renderer/components/modal/modal-types/login-modal.component.tsx
+++ b/src/renderer/components/modal/modal-types/login-modal.component.tsx
@@ -13,6 +13,7 @@ export const LoginModal: ModalComponent<{username: string, password: string, sta
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const [stay, setStay] = useState(false);
+ const [showPassword, setShowPassword] = useState(false);
const t = useTranslation();
const loggin = () => {
@@ -31,11 +32,14 @@ export const LoginModal: ModalComponent<{username: string, password: string, sta
- setUsername(e.target.value)} value={username} type="text" name="username" id="username" placeholder={t("modals.steam-login.inputs.username.placeholder")}/>
+ setUsername(e.target.value)} value={username} type="text" name="username" id="username" placeholder={t("modals.steam-login.inputs.username.placeholder")}/>
-
setPassword(e.target.value)} value={password} type="password" name="password" id="password" placeholder={t("modals.steam-login.inputs.password.placeholder")}/>
+
+ setPassword(e.target.value)} value={password} type={showPassword ? "text" : "password"} name="password" id="password" placeholder={t("modals.steam-login.inputs.password.placeholder")}/>
+ setShowPassword(prev => !prev)}/>
+
{password?.length > 64 && (
{t("modals.steam-login.inputs.password.max-length-warning")}
)}
diff --git a/src/renderer/components/svgs/bsm-icon.component.tsx b/src/renderer/components/svgs/bsm-icon.component.tsx
index 00f7e567..ca8ee5b7 100644
--- a/src/renderer/components/svgs/bsm-icon.component.tsx
+++ b/src/renderer/components/svgs/bsm-icon.component.tsx
@@ -58,9 +58,10 @@ import { ModelTypeSaberIcon } from "./icons/model-type-saber-icon.component";
import { ModelTypePlatformIcon } from "./icons/model-type-platform-icon.component";
import { ModelTypeBloqIcon } from "./icons/model-type-bloq-icon.component";
import { ChevronTopIcon } from "./icons/chevron-top-icon.component";
+import { EyeCrossIcon } from "./icons/eye-cross-icon.component";
export type BsmIconType = BsvMapCharacteristic | MSModelType | (
- "settings"|"trash"|"favorite"|"folder"|"bsNote"|"check"|"three-dots"|"twitch"|"eye"|"play"|"checkCircleIcon"|"discord"|"info"|
+ "settings"|"trash"|"favorite"|"folder"|"bsNote"|"check"|"three-dots"|"twitch"|"eye"|"play"|"checkCircleIcon"|"discord"|"info"|"eye-cross"|
"terminal"|"desktop"|"oculus"|"add"|"cross"|"task"|"github"|"close"|"thumbUpFill"|"timerFill"|"pause"|"twitter"|"sync"|"chevron-top"|
"copy"|"steam"|"edit"|"export"|"patreon"|"search"|"bsMapDifficulty"|"link"|"unlink"|"download"|"filter"|"mee6"|"volume-up"|"volume-off"|"volume-down"|
"fr-FR-flag"|"es-ES-flag"|"en-US-flag"|"en-EN-flag"|"de-DE-flag"
@@ -124,6 +125,7 @@ export const BsmIcon = memo(({className, icon, style}: {className?: string, icon
if(icon === "volume-down"){ return
}
if(icon === "volume-off"){ return }
if(icon === "chevron-top"){ return }
+ if(icon === "eye-cross"){ return }
if(icon === MSModelType.Avatar){ return }
if(icon === MSModelType.Saber){ return }
diff --git a/src/renderer/components/svgs/icons/eye-cross-icon.component.tsx b/src/renderer/components/svgs/icons/eye-cross-icon.component.tsx
new file mode 100644
index 00000000..6f05bc36
--- /dev/null
+++ b/src/renderer/components/svgs/icons/eye-cross-icon.component.tsx
@@ -0,0 +1,9 @@
+import { CSSProperties } from "react";
+
+export function EyeCrossIcon(props: {className?: string, style?: CSSProperties}) {
+ return (
+
+ )
+}