Max Red - Modified some things, I don't know which [skip ci]

This commit is contained in:
ivan 2017-01-10 18:27:53 -03:00
parent b75660ec1d
commit 6fc460d4b6
2 changed files with 17 additions and 4 deletions

View File

@ -6,7 +6,8 @@ class ToggleList extends React.Component {
static propTypes = {
items: React.PropTypes.arrayOf(React.PropTypes.shape({
content: React.PropTypes.node
}))
})),
onChange: React.PropTypes.func
};
state = {
@ -42,10 +43,21 @@ class ToggleList extends React.Component {
selectItem(index) {
let actual = _.clone(this.state.selected);
(_.includes(this.state.selected, index)) ? (_.remove(actual, t => t == index)) : (actual.push(index));
_.includes(this.state.selected, index) ? _.remove(actual, t => t == index) : actual.push(index);
console.log(actual);
this.setState({
selected: actual
});
if (this.props.onChange) {
this.props.onChange({
target: {
value: actual
}
});
}
}
}

View File

@ -5,9 +5,10 @@
&__item {
border: 1px $light-grey solid;
border-left: none;
width: 120px;
width: 180px;
height: 120px;
display: inline-block;
transition: background-color 0.4s ease;
}
&__selected {
@ -17,4 +18,4 @@
&__first-item {
border: 1px $light-grey solid;
}
}
}