ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit 90b0b460fd8a060760e7ec0ba953cd3d927e0e04
parent 3e17d7d280df1260686c51d4c906c70d0d8cbbac
Author: Konstantin Tarkus <hello@tarkus.me>
Date:   Tue, 16 Dec 2014 10:55:36 +0300

Add a sample TextBox component

Diffstat:
Asrc/components/forms/TextBox.js | 40++++++++++++++++++++++++++++++++++++++++
Asrc/components/forms/TextBox.less | 10++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/src/components/forms/TextBox.js b/src/components/forms/TextBox.js @@ -0,0 +1,40 @@ +/* + * React.js Starter Kit + * Copyright (c) 2014 Konstantin Tarkus (@koistya), KriaSoft LLC. + * + * This source code is licensed under the MIT license found in the + * LICENSE.txt file in the root directory of this source tree. + */ + +'use strict'; + +require('./TextBox.less'); + +var React = require('react'); + +var TextBox = React.createClass({ + + propTypes: { + maxLines: React.PropTypes.number + }, + + getDefaultProps() { + return { + maxLines: 1 + }; + }, + + render() { + return ( + <div className="TextBox"> + {this.props.maxLines > 1 ? + <textarea {...this.props} className="TextBox-input" ref="input" key="input" rows={this.props.maxLines} /> : + <input {...this.props} className="TextBox-input" ref="input" key="input" />} + </div> + ); + } + +}); + +module.exports = TextBox; + diff --git a/src/components/forms/TextBox.less b/src/components/forms/TextBox.less @@ -0,0 +1,10 @@ +/* + * React.js Starter Kit + * Copyright (c) 2014 Konstantin Tarkus (@koistya), KriaSoft LLC. + * + * This source code is licensed under the MIT license found in the + * LICENSE.txt file in the root directory of this source tree. + */ + +.TextBox {} +.TextBox-input {}