Created
January 21, 2016 17:43
-
-
Save jednano/66a00561d1649e4f6bec to your computer and use it in GitHub Desktop.
TypeScript/React example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
EventHandler, | |
FormEvent | |
} from 'react'; | |
import { ElementProps, resolveClassNames } from '../../../helpers/bem'; | |
import { Label } from '../../Form'; | |
export default class InputPassword extends Component< | |
InputPasswordProps, | |
InputPasswordState | |
> { | |
public render() { | |
const { | |
element, | |
modifiers, | |
helpMessage, | |
helpAction, | |
value, | |
onChange, | |
inputTabIndex, | |
helpActionTabIndex, | |
} = this.props; | |
return resolveClassNames( | |
<div {...{ element, modifiers }}> | |
<Label | |
block="form-label" | |
modifiers="full-width" | |
label="Password" | |
{...{ helpMessage, helpAction }} | |
tabIndex={helpActionTabIndex} | |
> | |
<input | |
element="input" | |
type="password" | |
name="password" | |
autoComplete="off" | |
{...{ value, onChange }} | |
tabIndex={inputTabIndex} | |
/> | |
</Label> | |
</div> | |
); | |
} | |
} | |
interface InputPasswordProps extends ElementProps { | |
helpMessage: string; | |
helpAction?: Function; | |
value?: string; | |
onChange?: EventHandler<FormEvent>; | |
helpActionTabIndex?: number; | |
inputTabIndex?: number; | |
} | |
interface InputPasswordState { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment