summaryrefslogtreecommitdiff
path: root/ui/app/components/center.js
blob: e7e074af611c6a6fc8622e6580a864b8ac4f09f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// puts a block right in the center of the window
//

import React from 'react'
import PropTypes from 'prop-types'

const Center = props => (
  <div className={"center-container center-" + props.direction}>
    <div className="center-item" style={props.width ? {width: props.width + 'px'} : null}>
      {props.children}
    </div>
  </div>
)

Center.defaultProps = {
  width: null,
  direction: 'both'
}

Center.propTypes = {
  children: PropTypes.oneOfType([
    PropTypes.element,
    PropTypes.arrayOf(
      PropTypes.element
    )
  ])
}

export default Center