Last change
on this file since ffd50db was dbd4834, checked in by Marko <Marko@…>, 2 years ago |
Homepage, login and register components added
|
-
Property mode
set to
100644
|
File size:
786 bytes
|
Rev | Line | |
---|
[dbd4834] | 1 | import React, { Component } from 'react'
|
---|
| 2 |
|
---|
| 3 | export class InputFormComponent extends Component {
|
---|
| 4 |
|
---|
| 5 | constructor(props) {
|
---|
| 6 | super(props)
|
---|
| 7 |
|
---|
| 8 | this.state = {
|
---|
| 9 | focused: false
|
---|
| 10 | }
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | handleFocus = (e) => {
|
---|
| 14 | this.setState({
|
---|
| 15 | focused: true
|
---|
| 16 | })
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | render() {
|
---|
| 20 |
|
---|
| 21 | const {errorMessage,setValue, ...inputProps} = this.props
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | return (
|
---|
| 25 | <div className='inputform-validation-container'>
|
---|
| 26 | <input className = 'validation-inputs' onChange={(e) => this.props.setValue(e)}
|
---|
| 27 | {...inputProps}
|
---|
| 28 | onBlur={this.handleFocus}
|
---|
| 29 | focused={this.state.focused.toString()}
|
---|
| 30 | />
|
---|
| 31 | <span className='form-error-span'>{this.props.errorMessage}</span>
|
---|
| 32 | </div>
|
---|
| 33 | )
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | export default InputFormComponent
|
---|
Note:
See
TracBrowser
for help on using the repository browser.