-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
small fixes and new props #22
base: master
Are you sure you want to change the base?
Changes from 2 commits
8cddacb
b428fe6
8f8789b
e29188d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ const Input = React.createClass({ | |
placeholder: PropTypes.string, | ||
onBlur: PropTypes.func, | ||
getTagStyle: PropTypes.func, | ||
transformTag: PropTypes.func | ||
transformTag: PropTypes.func, | ||
inputClass: PropTypes.string, | ||
inputAutoSize: PropTypes.bool | ||
}, | ||
|
||
focusInput() { | ||
|
@@ -56,18 +58,23 @@ const Input = React.createClass({ | |
|
||
render() { | ||
const placeholder = this.props.placeholder || ''; | ||
let size = this.props.value.length === 0 ? | ||
placeholder.length : | ||
this.props.value.length; | ||
let extraProps = {}; | ||
|
||
if (this.props.inputAutoSize){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space between |
||
extraProps["size"] = (this.props.value.length === 0 ? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since there are no more There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, with null is better, I forgot that react is so smart. I would like to add other props, for example "maxlength" is a must, for me at least it ruins CSS if you type or paste a large text, when using the "size" attribute. |
||
placeholder.length : | ||
this.props.value.length) + 2 | ||
} | ||
|
||
return ( | ||
<div className='cti__input' onClick={this.focusInput}> | ||
{this.getTags()} | ||
<input type='text' ref='input' value={this.props.value} | ||
size={size + 2} | ||
{...extraProps} | ||
onFocus={this.props.openPanel} onBlur={this.onBlur} | ||
onChange={this.props.onValueChange} onKeyDown={this.props.onKeyDown} | ||
placeholder={placeholder} aria-label={placeholder} | ||
className='cti__input__input' /> | ||
className={this.props.inputClass === undefined ? 'cti__input__input' : this.props.inputClass} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/ |
||
<div className='cti__input__arrow' /> | ||
</div> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ const Panel = React.createClass({ | |
<Category key={c.id} items={c.items} category={c.id} title={c.title} | ||
selected={this.props.selection.category === i} | ||
selectedItem={this.props.selection.item} | ||
input={this.props.input} addNew={this.props.addNew} | ||
input={this.props.input} addNew={c.addNew===undefined ? this.props.addNew : !!c.addNew} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/ |
||
type={c.type} onAdd={this.props.onAdd} single={c.single} | ||
getTagStyle={this.props.getTagStyle} | ||
getCreateNewText={this.props.getCreateNewText} /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/dissalow/disallow/