Update ListSetting to use util/toggle

main
raboid 6 years ago committed by Michael Fix
parent e5b3d39d4e
commit ee6f8ffdc2

@ -1,24 +1,19 @@
import React from 'react' import React from 'react'
import Checkmark from './svg/Checkmark' import Checkmark from './svg/Checkmark'
import { COLORS } from '../lib/constants' import { COLORS } from '../lib/constants'
import { toggle } from '../lib/util'
class ListSetting extends React.Component { class ListSetting extends React.Component {
constructor(props) { state = { isVisible: false }
super(props)
this.state = { isVisible: false }
this.select = this.select.bind(this)
this.toggle = this.toggle.bind(this)
}
select(item) { select = id => {
if (this.props.selected !== item) { if (this.props.selected !== id) {
this.props.onChange(item) this.props.onChange(id)
} }
} }
toggle() { toggle = () => this.setState(toggle('isVisible'))
this.setState({ isVisible: !this.state.isVisible })
}
renderListItems() { renderListItems() {
return this.props.items.map(item => ( return this.props.items.map(item => (

Loading…
Cancel
Save