Fix a bunch of layout issues
This commit is contained in:
37
website/src/ui/Row.js
Normal file
37
website/src/ui/Row.js
Normal 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)
|
||||
Reference in New Issue
Block a user