import * as React from 'react'; import * as classNames from 'classnames'; import {HTMLProps, PureComponent, SFC} from 'react'; import {Icon, Input as ReactstrapInput} from './../../../../components'; export interface Props extends HTMLProps { showRevealPasswordButton?: boolean; state: string; } export interface State { revealPassword: boolean; } export class Input extends PureComponent { state: State = { revealPassword: false, }; render() { const {showRevealPasswordButton, type, ...otherProps} = this.props; const {revealPassword} = this.state; const modifiedType = revealPassword ? 'text' : type; const hasNoErrors = this.props.state !== 'danger'; return ( type === 'text' ? ( ) : type === 'password' ? (
{hasNoErrors && this.renderRevealPasswordButton()}
) : null ) as any; } renderRevealPasswordButton = () => { const {revealPassword} = this.state; return ( ); } toggleRevealPassword = () => this.setState({revealPassword: !this.state.revealPassword}); }