Fix a bunch of layout issues

This commit is contained in:
John Lyon-Smith
2018-02-26 12:05:23 -08:00
parent ab243dc6db
commit f8e930d59e
29 changed files with 279 additions and 301 deletions

37
website/src/ui/Row.js Normal file
View File

@@ -0,0 +1,37 @@
import Radium from 'radium'
import React, { Component } from 'react'
import PropTypes from 'prop-types'
class Row extends Component {
static propTypes = {
children: PropTypes.node,
minWidth: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]).isRequired
}
render() {
const { children, minWidth } = this.props
return (
<div style={{ display: 'flex', minWidth, flexDirection: 'row' }}>{children}</div>
)
}
}
Row.Item = Radium(class RowLayoutItem extends Component {
static propTypes = {
children: PropTypes.node,
minWidth: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
grow: PropTypes.bool,
}
render() {
const { children, grow, minWidth } = this.props
const flexGrow = grow ? 1 : null
return (
<div style={{ minWidth, flexGrow }}>{children}</div>
)
}
})
export default Radium(Row)