| 28 | |
| 29 | @pureRender |
| 30 | export default class extends Component { |
| 31 | |
| 32 | static defaultProps = { |
| 33 | text: '', |
| 34 | textStyle: null, |
| 35 | headerStyle: null, |
| 36 | } |
| 37 | |
| 38 | getComputedStyles = () => { |
| 39 | const {textStyle, headerStyle} = this.props |
| 40 | |
| 41 | return { |
| 42 | container: headerStyle |
| 43 | ? prefix({...styles.container, ...headerStyle}) |
| 44 | : styles.container, |
| 45 | text: textStyle |
| 46 | ? prefix({...styles.text, ...textStyle}) |
| 47 | : styles.text, |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | render() { |
| 52 | const {children, text} = this.props |
| 53 | const computedStyles = this.getComputedStyles() |
| 54 | |
| 55 | return ( |
| 56 | <div style={computedStyles.container}> |
| 57 | <div style={computedStyles.text}> |
| 58 | {text} |
| 59 | </div> |
| 60 | <div style={styles.spacer} /> |
| 61 | {children} |
| 62 | </div> |
| 63 | ) |
| 64 | } |
| 65 | } |