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 {
|
|
|
|
togglePassword: any;
|
|
|
|
isPasswordVisible?: boolean;
|
|
|
|
input: any;
|
|
|
|
meta: any;
|
|
|
|
}
|
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-07-27 13:05:09 -04:00
|
|
|
const { input, meta, isPasswordVisible, togglePassword } = this.props;
|
|
|
|
|
2017-06-20 01:14:23 -05:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div className="input-group" style={{ width: '100%' }}>
|
|
|
|
<input
|
2017-07-27 13:05:09 -04:00
|
|
|
{...input}
|
2017-06-20 01:14:23 -05:00
|
|
|
name="password"
|
2017-07-27 13:05:09 -04:00
|
|
|
className={`form-control ${meta.error ? 'is-invalid' : ''}`}
|
|
|
|
type={isPasswordVisible ? 'text' : 'password'}
|
2017-09-24 19:06:28 -07:00
|
|
|
placeholder={translateRaw('GEN_Placeholder_1')}
|
|
|
|
aria-label={translateRaw('GEN_Aria_1')}
|
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
|
|
|
}
|