mirror of https://github.com/sgoudham/carbon.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
522 B
JavaScript
28 lines
522 B
JavaScript
7 years ago
|
import React from 'react'
|
||
|
import Toggle from './Toggle'
|
||
|
import Arrowdown from './svg/Arrowdown'
|
||
|
|
||
|
class Collapse extends React.Component {
|
||
|
constructor(props) {
|
||
|
super(props)
|
||
|
this.state = {
|
||
|
open: false
|
||
|
}
|
||
|
}
|
||
|
|
||
|
toggle = () => {
|
||
|
this.setState(state => ({
|
||
|
open: !state.open
|
||
|
}))
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
if (this.state.open) {
|
||
|
return this.props.children
|
||
|
}
|
||
|
return <Toggle enabled={false} center={true} label={this.props.label} onChange={this.toggle} />
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default Collapse
|