2016-09-16 21:19:37 +00:00
|
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
|
import radium from 'radium';
|
|
|
|
|
import { Link } from 'react-router';
|
2016-10-19 20:22:18 +00:00
|
|
|
|
|
2016-09-16 21:19:37 +00:00
|
|
|
|
import componentStyles from './styles';
|
|
|
|
|
|
|
|
|
|
class StackedWhiteBoxes extends Component {
|
|
|
|
|
static propTypes = {
|
|
|
|
|
children: PropTypes.element,
|
|
|
|
|
headerText: PropTypes.string,
|
|
|
|
|
leadText: PropTypes.string,
|
|
|
|
|
previousLocation: PropTypes.string,
|
2016-10-21 23:13:41 +00:00
|
|
|
|
style: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
2016-09-16 21:19:37 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
|
style: {},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
renderBackButton = () => {
|
|
|
|
|
const { previousLocation } = this.props;
|
|
|
|
|
const { exStyles, exWrapperStyles } = componentStyles;
|
|
|
|
|
|
|
|
|
|
if (!previousLocation) return false;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div style={exWrapperStyles}>
|
2016-09-23 18:04:01 +00:00
|
|
|
|
<Link style={exStyles} to={previousLocation}>╳</Link>
|
2016-09-16 21:19:37 +00:00
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
renderHeader = () => {
|
|
|
|
|
const { headerStyles, headerWrapperStyles } = componentStyles;
|
|
|
|
|
const { headerText, style } = this.props;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div style={[headerWrapperStyles, style.headerWrapper]}>
|
|
|
|
|
<p style={headerStyles}>{headerText}</p>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
|
const { children, leadText } = this.props;
|
|
|
|
|
const {
|
|
|
|
|
boxStyles,
|
|
|
|
|
containerStyles,
|
|
|
|
|
textStyles,
|
|
|
|
|
} = componentStyles;
|
|
|
|
|
const { renderBackButton, renderHeader } = this;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div style={containerStyles}>
|
|
|
|
|
<div style={boxStyles}>
|
|
|
|
|
{renderBackButton()}
|
|
|
|
|
{renderHeader()}
|
|
|
|
|
<p style={textStyles}>{leadText}</p>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default radium(StackedWhiteBoxes);
|