Created
December 22, 2016 23:57
-
-
Save SvitlanaShepitsena/2cd597f56f8d2a042398809686699771 to your computer and use it in GitHub Desktop.
React 'card' header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {PropTypes} from 'react'; | |
import Radium from 'radium'; | |
import muiTheme from '../../../../../../../../../configuration/webapp/muiTheme.js'; | |
class SearchCard_Classic_Header extends React.Component { | |
static propTypes = { | |
customHeaderStyle: PropTypes.object, | |
danger: PropTypes.bool, | |
primary: PropTypes.bool, | |
}; | |
getStyles() { | |
let {danger, primary} = this.props; | |
let sv_color; | |
if (danger) { | |
sv_color = muiTheme.palette.accent1Color; | |
} | |
if (primary) { | |
sv_color = muiTheme.palette.primary1Color; | |
} | |
const styles = { | |
searchHeader_Container: { | |
padding: 5, | |
backgroundColor: sv_color | |
}, | |
}; | |
return styles; | |
} | |
render() { | |
const styles = this.getStyles(); | |
return ( | |
<div style={[styles.searchHeader_Container, this.props.customHeaderStyle]}> | |
{this.props.children} | |
</div> | |
); | |
} | |
} | |
export default Radium(SearchCard_Classic_Header); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment