Skip to content

Commit

Permalink
Merge pull request #491 from Infosys/bug/variable-image
Browse files Browse the repository at this point in the history
[ES-393] disable button state & show hide password icon
  • Loading branch information
aranaravi authored Nov 28, 2023
2 parents 2712686 + 6742667 commit a38d193
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions oidc-ui/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@
}

.primary-button:disabled {
cursor: not-allowed;
color: var(--primary-button-disable-color);
background-color: var(--primary-button-disable-bg-color);
border-color: var(--primary-button-disable-border-color);
}

.primary-button:hover {
.primary-button:hover:not(:disabled) {
color: var(--primary-button-hover-color);
background-color: var(--primary-button-hover-bg-color);
border-color: var(--primary-button-hover-border-color);
Expand All @@ -81,12 +82,13 @@
}

.secondary-button:disabled {
cursor: not-allowed;
color: var(--secondary-button-disable-color);
background-color: var(--secondary-button-disable-bg-color);
border-color: var(--secondary-button-disable-border-color);
}

.secondary-button:hover {
.secondary-button:hover:not(:disabled) {
color: var(--secondary-button-hover-color);
background-color: var(--secondary-button-hover-bg-color);
border-color: var(--secondary-button-hover-border-color);
Expand Down
10 changes: 6 additions & 4 deletions oidc-ui/src/components/InputWithImage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react";
import { useState, useRef } from "react";
import { useTranslation } from "react-i18next";

const fixedInputClass =
Expand Down Expand Up @@ -27,11 +27,12 @@ export default function InputWithImage({
const { t } = useTranslation("translation", { keyPrefix: i18nKeyPrefix });

const [showPassword, setShowPassword] = useState(false);
const inputVal = useRef(value);

const changePasswordState = () => {
setShowPassword(!showPassword);
let passwordRef = document.getElementById(id);
passwordRef.setAttribute("type", showPassword ? "text" : "password");
passwordRef.setAttribute("type", !showPassword ? "text" : "password");
setShowPassword(!showPassword);
};

return (
Expand Down Expand Up @@ -59,6 +60,7 @@ export default function InputWithImage({
</div>
}
<input
ref={inputVal}
disabled={disabled}
onChange={handleChange}
onBlur={blurChange}
Expand All @@ -71,7 +73,7 @@ export default function InputWithImage({
placeholder={placeholder}
title={t(tooltipMsg)}
/>
{type === "password" && (
{type === "password" && inputVal.current.value !== "" && (
<span
className="flex absolute inset-y-0 p-3 pt-2 ltr:right-0 rtl:left-0 cursor-pointer"
onClick={changePasswordState}
Expand Down

0 comments on commit a38d193

Please sign in to comment.