Skip to content

Commit

Permalink
feat: Add useTranslation on FieldPassword
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola LEGAY authored and Nikola LEGAY committed Jul 24, 2024
1 parent b70b260 commit 0e2e972
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Form/FieldPassword/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
FieldPath,
FieldValues,
} from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { RiEyeCloseLine, RiEyeLine } from 'react-icons/ri';

import { FieldCommonProps } from '@/components/Form/FormFieldController';
Expand All @@ -38,6 +39,7 @@ export const FieldPassword = <
>(
props: FieldPasswordProps<TFieldValues, TName>
) => {
const { t } = useTranslation();
const [showPassword, setShowPassword] = useState(false);
return (
<Controller
Expand All @@ -56,7 +58,11 @@ export const FieldPassword = <
<IconButton
isDisabled={props.isDisabled}
onClick={() => setShowPassword((x) => !x)}
aria-label={showPassword ? 'Hide password' : 'Show password'} // TODO: translation
aria-label={
showPassword
? t('password.hide', 'Hide password')
: t('password.show', 'Show password')
}
display="flex"
size="xs"
fontSize="lg"
Expand Down

0 comments on commit 0e2e972

Please sign in to comment.