Skip to content

Commit

Permalink
merge classNames prop with default classes obj. Fix #227
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandernst committed Nov 10, 2020
1 parent 8b517ab commit 592d43c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/ReactTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,15 @@ class ReactTags extends React.Component {
const TagComponent = this.props.tagComponent || Tag

const expanded = this.state.focused && this.state.query.length >= this.props.minQueryLength
const classNames = [this.props.classNames.root]
const classes = Object.assign({}, CLASS_NAMES, this.props.classNames)
const rootClasses = [classes.root]

this.state.focused && classNames.push(this.props.classNames.rootFocused)
this.state.focused && rootClasses.push(classes.rootFocused)

return (
<div ref={this.container} className={classNames.join(' ')} onClick={this.onClick.bind(this)}>
<div ref={this.container} className={rootClasses.join(' ')} onClick={this.onClick.bind(this)}>
<div
className={this.props.classNames.selected}
className={classes.selected}
aria-relevant='additions removals'
aria-live='polite'
>
Expand All @@ -263,17 +264,17 @@ class ReactTags extends React.Component {
key={i}
tag={tag}
removeButtonText={this.props.removeButtonText}
classNames={this.props.classNames}
classNames={classes}
onDelete={this.onDeleteTag.bind(this, i)}
/>
))}
</div>
<div className={this.props.classNames.search}>
<div className={classes.search}>
<Input
{...this.state}
id={this.props.id}
ref={this.input}
classNames={this.props.classNames}
classNames={classes}
inputAttributes={this.props.inputAttributes}
inputEventHandlers={this.inputEventHandlers}
autoresize={this.props.autoresize}
Expand All @@ -285,7 +286,7 @@ class ReactTags extends React.Component {
{...this.state}
id={this.props.id}
ref={this.suggestions}
classNames={this.props.classNames}
classNames={classes}
expanded={expanded}
addTag={this.addTag.bind(this)}
suggestionComponent={this.props.suggestionComponent}
Expand Down

0 comments on commit 592d43c

Please sign in to comment.