diff --git a/web/account/log-in-form.react.js b/web/account/log-in-form.react.js --- a/web/account/log-in-form.react.js +++ b/web/account/log-in-form.react.js @@ -26,6 +26,7 @@ import { useSelector } from '../redux/redux-utils'; import { webLogInExtraInfoSelector } from '../selectors/account-selectors'; import css from './log-in-form.css'; +import PasswordInput from './password-input.react'; const loadingStatusSelector = createLoadingStatusSelector(logInActionTypes); function LoginForm(): React.Node { @@ -139,9 +140,7 @@
Password
- { + setHtmlInputType(oldType => (oldType === 'password' ? 'text' : 'password')); + }, [setHtmlInputType]); + + const icon: Icon = React.useMemo( + () => (htmlInputType === 'password' ? 'eye-open' : 'eye-closed'), + [htmlInputType], + ); + + return ( +
+ +
+ +
+
+ ); +} + +const ForwardedPasswordInput: React.AbstractComponent< + PasswordInputProps, + HTMLInputElement, +> = React.forwardRef(PasswordInput); + +export default ForwardedPasswordInput; diff --git a/web/modals/input.react.js b/web/modals/input.react.js --- a/web/modals/input.react.js +++ b/web/modals/input.react.js @@ -4,19 +4,30 @@ import css from './input.css'; -type Props = { - +type: string, - +placeholder: string, +export type BaseInputProps = { +value: string, +onChange: (value: SyntheticEvent) => mixed, +onBlur?: (value: SyntheticEvent) => mixed, +disabled?: boolean, +label?: string, +id?: string, + +className?: string, +}; + +export type InputProps = { + ...BaseInputProps, + +type: string, + +placeholder: string, }; -function Input(props: Props, ref): React.Node { - const { label: labelProp, disabled = false, id, ...rest } = props; +function Input(props: InputProps, ref): React.Node { + const { + label: labelProp, + disabled = false, + className = '', + id, + ...rest + } = props; let label; if (labelProp) { @@ -31,7 +42,7 @@ <> {label} = React.forwardRef(Input); +> = React.forwardRef(Input); export default ForwardedInput; diff --git a/web/theme.css b/web/theme.css --- a/web/theme.css +++ b/web/theme.css @@ -180,4 +180,5 @@ --compose-subchannel-label-color: var(--shades-black-60); --compose-subchannel-mark-color: var(--violet-light-100); --enum-option-icon-color: var(--violet-dark-100); + --show-password-bg-hover: var(--shades-black-70); }