2018-05-10 17:05:55 +02:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import Collapse from 'react-collapse'
|
2018-05-11 10:32:57 +02:00
|
|
|
import accessibility from '../../libs/accessibility'
|
2018-05-10 17:05:55 +02:00
|
|
|
|
|
|
|
|
2018-05-11 15:52:48 +02:00
|
|
|
export default class CollapseAlt extends React.Component {
|
2018-05-10 17:05:55 +02:00
|
|
|
static propTypes = {
|
|
|
|
isActive: PropTypes.bool.isRequired,
|
|
|
|
children: PropTypes.element.isRequired
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2018-05-11 10:32:57 +02:00
|
|
|
if (accessibility.reducedMotionEnabled()) {
|
2018-05-10 17:05:55 +02:00
|
|
|
return (
|
|
|
|
<div style={{display: this.props.isActive ? "block" : "none"}}>
|
|
|
|
{this.props.children}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return (
|
|
|
|
<Collapse isOpened={this.props.isActive}>
|
|
|
|
{this.props.children}
|
|
|
|
</Collapse>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|