maputnik/src/components/layers/Collapse.jsx

31 lines
683 B
React
Raw Normal View History

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