1
1
import React , { Component } from 'react' ;
2
2
import { Link } from 'react-router' ;
3
3
import { InputText } from '../../components/inputtext/InputText' ;
4
- import { Button } from '../../components/button/Button' ;
5
4
import { TabView , TabPanel } from '../../components/tabview/TabView' ;
6
5
import { CodeHighlight } from '../codehighlight/CodeHighlight' ;
7
6
8
7
export class InputTextDemo extends Component {
9
8
10
9
constructor ( ) {
11
10
super ( ) ;
12
- this . state = { } ;
13
- this . toggle = this . toggle . bind ( this ) ;
11
+ this . state = {
12
+ value : ''
13
+ } ;
14
14
}
15
15
16
16
toggle ( ) {
@@ -28,14 +28,8 @@ export class InputTextDemo extends Component {
28
28
</ div >
29
29
30
30
< div className = "content-section implementation" >
31
- < h3 > Basic</ h3 >
32
31
< InputText onChange = { ( e ) => this . setState ( { value : e . target . value } ) } />
33
32
< span style = { { marginLeft :'.5em' } } > { this . state . value } </ span >
34
-
35
- < h3 > Disabled</ h3 >
36
- < InputText disabled = { this . state . disabled } style = { { marginRight :'.25em' } } />
37
-
38
- < Button label = "Toggle" onClick = { this . toggle } />
39
33
</ div >
40
34
41
35
< InputTextDoc />
@@ -111,18 +105,18 @@ import {InputText} from 'primereact/components/inputtext/InputText';
111
105
</ a >
112
106
< CodeHighlight className = "javascript" >
113
107
{ `
108
+ import React, {Component} from 'react';
109
+ import {InputText} from '../../components/inputtext/InputText';
110
+
114
111
export class InputTextDemo extends Component {
115
-
112
+
116
113
constructor() {
117
114
super();
118
- this.state = {};
119
- this.toggle = this.toggle.bind(this);
120
- }
121
-
122
- toggle() {
123
- this.setState({disabled: !this.state.disabled});
115
+ this.state = {
116
+ value: ''
117
+ };
124
118
}
125
-
119
+
126
120
render() {
127
121
return (
128
122
<div>
@@ -134,14 +128,8 @@ export class InputTextDemo extends Component {
134
128
</div>
135
129
136
130
<div className="content-section implementation">
137
- <h3>Basic</h3>
138
131
<InputText onChange={(e) => this.setState({value: e.target.value})}/>
139
132
<span style={{marginLeft:'.5em'}}>{this.state.value}</span>
140
-
141
- <h3>Disabled</h3>
142
- <InputText disabled={this.state.disabled} style={{marginRight:'.25em'}}/>
143
-
144
- <Button label="Toggle" onClick={this.toggle}/>
145
133
</div>
146
134
</div>
147
135
)
0 commit comments