2017-06-20 01:14:23 -05:00
|
|
|
import React, { Component } from 'react';
|
2017-09-24 19:06:28 -07:00
|
|
|
import { translateRaw } from 'translations';
|
2017-04-18 18:01:25 -05:00
|
|
|
|
2017-09-24 19:06:28 -07:00
|
|
|
interface Props {
|
2017-11-27 15:31:23 -05:00
|
|
|
password: string;
|
|
|
|
onPasswordChange: any;
|
2017-09-24 19:06:28 -07:00
|
|
|
togglePassword: any;
|
|
|
|
isPasswordVisible?: boolean;
|
2017-11-27 15:31:23 -05:00
|
|
|
isPasswordValid: boolean;
|
2017-09-24 19:06:28 -07:00
|
|
|
}
|
2017-04-18 18:01:25 -05:00
|
|
|
|
2017-09-24 19:06:28 -07:00
|
|
|
export default class PasswordInput extends Component<Props, {}> {
|
|
|
|
public render() {
|
2017-11-27 15:31:23 -05:00
|
|
|
const {
|
|
|
|
password,
|
|
|
|
isPasswordValid,
|
|
|
|
isPasswordVisible,
|
|
|
|
togglePassword,
|
|
|
|
onPasswordChange
|
|
|
|
} = this.props;
|
2017-07-27 13:05:09 -04:00
|
|
|
|
2017-06-20 01:14:23 -05:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div className="input-group" style={{ width: '100%' }}>
|
|
|
|
<input
|
2017-11-27 15:31:23 -05:00
|
|
|
value={password}
|
2017-06-20 01:14:23 -05:00
|
|
|
name="password"
|
2017-11-27 15:31:23 -05:00
|
|
|
className={`form-control ${!isPasswordValid ? 'is-invalid' : ''}`}
|
2017-07-27 13:05:09 -04:00
|
|
|
type={isPasswordVisible ? 'text' : 'password'}
|
2017-09-24 19:06:28 -07:00
|
|
|
placeholder={translateRaw('GEN_Placeholder_1')}
|
|
|
|
aria-label={translateRaw('GEN_Aria_1')}
|
2017-11-27 15:31:23 -05:00
|
|
|
onChange={onPasswordChange}
|
2017-06-20 01:14:23 -05:00
|
|
|
/>
|
|
|
|
<span
|
2017-07-27 13:05:09 -04:00
|
|
|
onClick={togglePassword}
|
2017-09-24 19:06:28 -07:00
|
|
|
aria-label={translateRaw('GEN_Aria_2')}
|
2017-06-20 01:14:23 -05:00
|
|
|
role="button"
|
|
|
|
className="input-group-addon eye"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-04-18 18:01:25 -05:00
|
|
|
}
|