|
1 | | -import { Input } from 'or-input' |
2 | 1 | import React, { PureComponent } from 'react' |
3 | 2 |
|
| 3 | +import Input from 'or-input' |
| 4 | + |
4 | 5 | export default class Example extends PureComponent<{}, {}> { |
5 | 6 | state = { |
| 7 | + mail: '', |
6 | 8 | name: '', |
7 | | - age: '' |
| 9 | + keywords: '', |
| 10 | + age: '', |
| 11 | + zipcode: '' |
8 | 12 | } |
9 | 13 |
|
10 | 14 | render() { |
11 | 15 | return ( |
12 | | - <div> |
13 | | - <Input |
14 | | - placeholder="name" |
15 | | - value={this.state.name} |
16 | | - maxlength={12} |
17 | | - onChange={this.handleChange('name')} |
18 | | - /> |
19 | | - <Input |
20 | | - numericInput={true} |
21 | | - placeholder="age" |
22 | | - value={this.state.age} |
23 | | - maxlength={12} |
24 | | - onChange={this.handleChange('age')} |
25 | | - /> |
| 16 | + <div className="example-wrapper"> |
| 17 | + <div className="default-input"> |
| 18 | + <h1>default input:</h1> |
| 19 | + <Input |
| 20 | + placeholder="mail" |
| 21 | + value={this.state.mail} |
| 22 | + onChange={this.handleChange('mail')} |
| 23 | + /> |
| 24 | + </div> |
| 25 | + <div className=""> |
| 26 | + <h1>input with maxlength:</h1> |
| 27 | + <div className="input-with-label"> |
| 28 | + <div className="input-label">Name:</div> |
| 29 | + <Input |
| 30 | + placeholder="name maxlength 10" |
| 31 | + value={this.state.name} |
| 32 | + maxlength={10} |
| 33 | + onChange={this.handleChange('name')} |
| 34 | + /> |
| 35 | + </div> |
| 36 | + <div className="input-with-label"> |
| 37 | + <div className="input-label">Keywords:</div> |
| 38 | + <Input |
| 39 | + placeholder="keywords maxlength 12" |
| 40 | + value={this.state.keywords} |
| 41 | + maxlength={12} |
| 42 | + onChange={this.handleChange('keywords')} |
| 43 | + /> |
| 44 | + </div> |
| 45 | + </div> |
| 46 | + <div className=""> |
| 47 | + <h1>numeric input:</h1> |
| 48 | + <Input |
| 49 | + numericInput={true} |
| 50 | + placeholder="age" |
| 51 | + value={this.state.age} |
| 52 | + maxlength={3} |
| 53 | + onChange={this.handleChange('age')} |
| 54 | + /> |
| 55 | + </div> |
| 56 | + <div className=""> |
| 57 | + <h1>input value can be cleared:</h1> |
| 58 | + <Input |
| 59 | + canClear={false} |
| 60 | + numericInput={true} |
| 61 | + placeholder="zipcode" |
| 62 | + value={this.state.zipcode} |
| 63 | + maxlength={8} |
| 64 | + onChange={this.handleChange('zipcode')} |
| 65 | + /> |
| 66 | + </div> |
26 | 67 | </div> |
27 | 68 | ) |
28 | 69 | } |
|
0 commit comments