Refactored password visibility state and added small css fix

This commit is contained in:
Daniel Cojocea committed 2024-07-13 15:02:26 -04:00
1 parent 1e9bb5501e
commit 99b1130e29
7 files changed
+7 -31

No files matched your search

+4 -4
View File
@@ -19,8 +19,6 @@ const Field = ({
label,
isRequired,
isOptional,
isVisible,
setVisibility,
hasCopy,
autoComplete,
placeholder,
@@ -38,6 +36,8 @@ const Field = ({
setTimeout(() => setCopy(false), 1000);
};
const [isVisible, setVisible] = useState(false);
return (
<Stack gap={theme.gap.xs} className={`field field-${type}`}>
{label && (
@@ -75,7 +75,7 @@ const Field = ({
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
onClick={() => setVisibility((show) => !show)}
onClick={() => setVisible((show) => !show)}
tabIndex={-1}
sx={{
color: theme.palette.section.borderColor,
@@ -94,7 +94,7 @@ const Field = ({
</InputAdornment>
) : (
hasCopy && (
<InputAdornment position="end">
<InputAdornment className="copy" position="end">
<Button
level="tertiary"
label={copy ? "Copied" : "Copy"}