Max Red - Modified some things, I don't know which [skip ci]
This commit is contained in:
parent
b75660ec1d
commit
6fc460d4b6
|
@ -6,7 +6,8 @@ class ToggleList extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
items: React.PropTypes.arrayOf(React.PropTypes.shape({
|
items: React.PropTypes.arrayOf(React.PropTypes.shape({
|
||||||
content: React.PropTypes.node
|
content: React.PropTypes.node
|
||||||
}))
|
})),
|
||||||
|
onChange: React.PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -42,10 +43,21 @@ class ToggleList extends React.Component {
|
||||||
|
|
||||||
selectItem(index) {
|
selectItem(index) {
|
||||||
let actual = _.clone(this.state.selected);
|
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({
|
this.setState({
|
||||||
selected: actual
|
selected: actual
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.props.onChange) {
|
||||||
|
this.props.onChange({
|
||||||
|
target: {
|
||||||
|
value: actual
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
&__item {
|
&__item {
|
||||||
border: 1px $light-grey solid;
|
border: 1px $light-grey solid;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
width: 120px;
|
width: 180px;
|
||||||
height: 120px;
|
height: 120px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
transition: background-color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__selected {
|
&__selected {
|
||||||
|
|
Loading…
Reference in New Issue