Skip to content

Commit

Permalink
InputText refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Sep 10, 2017
1 parent f11bcaf commit a9864da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ class App extends Component {
<li className="topbar-submenu-header">THEMING</li>
<li><Link to="/theming"><span className="ui-text">Guide</span></Link></li>
<li className="topbar-submenu-header">PREMIUM</li>
<li><a href="https://www.primefaces.org/layouts/ultima-react"><img src="showcase/resources/images/layouts/themeswitcher-ultima.png" alt="Ultima (Material)" /><span class="ui-text">Ultima</span></a></li>
<li><a href="https://www.primefaces.org/layouts/avalon-react"><img src="showcase/resources/images/layouts/themeswitcher-avalon.png" alt="Avalon (Bootstrap)" /><span class="ui-text">Avalon</span></a></li>
<li><a href="https://www.primefaces.org/layouts/ultima-react"><img src="showcase/resources/images/layouts/themeswitcher-ultima.png" alt="Ultima (Material)" /><span className="ui-text">Ultima</span></a></li>
<li><a href="https://www.primefaces.org/layouts/avalon-react"><img src="showcase/resources/images/layouts/themeswitcher-avalon.png" alt="Avalon (Bootstrap)" /><span className="ui-text">Avalon</span></a></li>
<li className="topbar-submenu-header">THEMES</li>
<li><a href="#" data-theme="omega" onClick={this.changeTheme}><span className="ui-text">Omega</span></a></li>
<li><a href="#" data-theme="cruze" onClick={this.changeTheme}><span className="ui-text">Cruze</span></a></li>
Expand Down
34 changes: 11 additions & 23 deletions src/showcase/inputtext/InputTextDemo.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, {Component} from 'react';
import {Link} from 'react-router';
import {InputText} from '../../components/inputtext/InputText';
import {Button} from '../../components/button/Button';
import {TabView,TabPanel} from '../../components/tabview/TabView';
import {CodeHighlight} from '../codehighlight/CodeHighlight';

export class InputTextDemo extends Component {

constructor() {
super();
this.state = {};
this.toggle = this.toggle.bind(this);
this.state = {
value: ''
};
}

toggle() {
Expand All @@ -28,14 +28,8 @@ export class InputTextDemo extends Component {
</div>

<div className="content-section implementation">
<h3>Basic</h3>
<InputText onChange={(e) => this.setState({value: e.target.value})}/>
<span style={{marginLeft:'.5em'}}>{this.state.value}</span>

<h3>Disabled</h3>
<InputText disabled={this.state.disabled} style={{marginRight:'.25em'}}/>

<Button label="Toggle" onClick={this.toggle}/>
</div>

<InputTextDoc />
Expand Down Expand Up @@ -111,18 +105,18 @@ import {InputText} from 'primereact/components/inputtext/InputText';
</a>
<CodeHighlight className="javascript">
{`
import React, {Component} from 'react';
import {InputText} from '../../components/inputtext/InputText';
export class InputTextDemo extends Component {
constructor() {
super();
this.state = {};
this.toggle = this.toggle.bind(this);
}
toggle() {
this.setState({disabled: !this.state.disabled});
this.state = {
value: ''
};
}
render() {
return (
<div>
Expand All @@ -134,14 +128,8 @@ export class InputTextDemo extends Component {
</div>
<div className="content-section implementation">
<h3>Basic</h3>
<InputText onChange={(e) => this.setState({value: e.target.value})}/>
<span style={{marginLeft:'.5em'}}>{this.state.value}</span>
<h3>Disabled</h3>
<InputText disabled={this.state.disabled} style={{marginRight:'.25em'}}/>
<Button label="Toggle" onClick={this.toggle}/>
</div>
</div>
)
Expand Down

0 comments on commit a9864da

Please sign in to comment.