|
@@ -1,5 +1,4 @@
|
|
|
import React from 'react';
|
|
|
-import { Motion, spring } from 'react-motion';
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
class ColumnCollapsable extends React.PureComponent {
|
|
@@ -29,21 +28,16 @@ class ColumnCollapsable extends React.PureComponent {
|
|
|
render () {
|
|
|
const { icon, title, fullHeight, children } = this.props;
|
|
|
const { collapsed } = this.state;
|
|
|
- const collapsedClassName = collapsed ? 'collapsable-collapsed' : 'collapsable';
|
|
|
|
|
|
return (
|
|
|
- <div className='column-collapsable'>
|
|
|
- <div role='button' tabIndex='0' title={`${title}`} className={`column-icon ${collapsedClassName}`} onClick={this.handleToggleCollapsed}>
|
|
|
+ <div className={`column-collapsable ${collapsed ? 'collapsed' : ''}`}>
|
|
|
+ <div role='button' tabIndex='0' title={`${title}`} className='column-collapsable__button column-icon' onClick={this.handleToggleCollapsed}>
|
|
|
<i className={`fa fa-${icon}`} />
|
|
|
</div>
|
|
|
|
|
|
- <Motion defaultStyle={{ opacity: 0, height: 0 }} style={{ opacity: spring(collapsed ? 0 : 100), height: spring(collapsed ? 0 : fullHeight, collapsed ? undefined : { stiffness: 150, damping: 9 }) }}>
|
|
|
- {({ opacity, height }) =>
|
|
|
- <div style={{ overflow: height === fullHeight ? 'auto' : 'hidden', height: `${height}px`, opacity: opacity / 100, maxHeight: '70vh' }}>
|
|
|
- {children}
|
|
|
- </div>
|
|
|
- }
|
|
|
- </Motion>
|
|
|
+ <div className='column-collapsable__content' style={{ height: `${fullHeight}px`, maxHeight: '70vh' }}>
|
|
|
+ {children}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
}
|