mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 06:32:39 +00:00
'Sheet
This commit is contained in:
44
client/tpk/sheetRenderer/parts/textInput/textInput.jsx
Normal file
44
client/tpk/sheetRenderer/parts/textInput/textInput.jsx
Normal file
@@ -0,0 +1,44 @@
|
||||
var React = require('react');
|
||||
var _ = require('lodash');
|
||||
var cx = require('classnames');
|
||||
|
||||
var utils = require('../utils');
|
||||
|
||||
var TextInput = React.createClass({
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
name : 'text',
|
||||
defaultData : '',
|
||||
|
||||
id : '',
|
||||
label : '',
|
||||
};
|
||||
},
|
||||
|
||||
id : utils.id,
|
||||
data : utils.data,
|
||||
updateData : utils.updateData,
|
||||
|
||||
handleChange : function(e){
|
||||
this.updateData(e.target.value);
|
||||
},
|
||||
|
||||
renderLabel : function(){
|
||||
if(this.props.label) return <label htmlFor={this.id()}>{this.props.label}</label>
|
||||
},
|
||||
|
||||
render : function(){
|
||||
return <div className='textInput'>
|
||||
{this.renderLabel()}
|
||||
<input
|
||||
id={this.id()}
|
||||
type='text'
|
||||
onChange={this.handleChange}
|
||||
value={this.data()}
|
||||
placeholder={this.props.placeholder}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = TextInput;
|
||||
6
client/tpk/sheetRenderer/parts/textInput/textInput.less
Normal file
6
client/tpk/sheetRenderer/parts/textInput/textInput.less
Normal file
@@ -0,0 +1,6 @@
|
||||
.textInput{
|
||||
label{
|
||||
display: inline-block;
|
||||
width : 50px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user