Add initial height props

Default is now 50/50 instead of 60/40, but can be specified on a per
use basis
pull/10616/head
Alex P 2017-05-10 11:27:57 -07:00
parent 8018e99b47
commit b88e54e4df
1 changed files with 8 additions and 3 deletions

View File

@ -6,14 +6,15 @@ import ResizeHandle from 'shared/components/ResizeHandle'
const maximumNumChildren = 2
const minimumTopHeight = 200
const minimumBottomHeight = 200
const initialHeight = '50%'
class ResizeContainer extends Component {
constructor(props) {
super(props)
this.state = {
isDragging: false,
topHeight: '60%',
bottomHeight: '40%',
topHeight: this.props.initialTopHeight,
bottomHeight: this.props.initialBottomHeight,
}
this.handleStartDrag = ::this.handleStartDrag
@ -25,6 +26,8 @@ class ResizeContainer extends Component {
static defaultProps = {
minTopHeight: minimumTopHeight,
minBottomHeight: minimumBottomHeight,
initialTopHeight: initialHeight,
initialBottomHeight: initialHeight,
}
handleStartDrag() {
@ -130,6 +133,8 @@ ResizeContainer.propTypes = {
containerClass: string.isRequired,
minTopHeight: number,
minBottomHeight: number,
initialTopHeight: string,
initialBottomHeight: string,
}
export default ResizeContainer