Created
December 22, 2016 23:55
-
-
Save SvitlanaShepitsena/9f7fc88f4ffc481a971bc7ff83694fc7 to your computer and use it in GitHub Desktop.
React 'Card' with borders
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 extends React.Component { | |
static propTypes = { | |
borderRadius: PropTypes.number, | |
danger: PropTypes.bool, | |
primary: PropTypes.bool, | |
}; | |
getStyles() { | |
let {danger, primary, borderRadius} = this.props; | |
let sv_color; | |
if (danger) { | |
sv_color = muiTheme.palette.accent1Color; | |
} | |
if (primary) { | |
sv_color = muiTheme.palette.primary1Color; | |
} | |
const styles = { | |
searchCard_Container: { | |
border: `1px solid ${sv_color}`, | |
borderRadius: borderRadius ? borderRadius : 2, | |
width: '100%', | |
maxWidth: '100%' | |
}, | |
}; | |
return styles; | |
} | |
render() { | |
const styles = this.getStyles(); | |
return ( | |
<div style={styles.searchCard_Container}> | |
{this.props.children} | |
</div> | |
); | |
} | |
} | |
export default Radium(SearchCard_Classic); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment