1.0.1 • Published 8 years ago

patchkit-vertical-filled v1.0.1

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
8 years ago

Vertical Filled Container

A container-component that will take the full vertical space, and resize with the window.

import VerticalFilledContainer from 'patchkit-vertical-filled'

<VerticalFilledContainer>
  This container will extend to the bottom of the screen, even when you resize.
</VerticalFilledContainer>

You can use the decorator to add the behavior to another component. This is the actual definition of <VerticalFilledContainer>:

import { verticalFilled } from 'patchkit-vertical-filled'

class _VerticalFilledContainer extends React.Component {
  render() {
    var style = { position: 'relative', overflow: 'auto' }
    
    if (this.props.height)
      style.height = this.props.height

    if (this.props.style && typeof this.props.style == 'object') {
      for (var k in this.props.style)
        style[k] = this.props.style[k]
    }

    return <div className="vertical-filled" {...this.props} style={style}>{this.props.children||''}</div>
  }
}
var VerticalFilledContainer = verticalFilled(_VerticalFilledContainer)