Created
April 5, 2017 17:17
-
-
Save PolGuixe/8abbac0a720e78a12eeb382ef1ef4549 to your computer and use it in GitHub Desktop.
Clickable Material UI Card
This file contains 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
// ... do all required imports ... | |
const getStyles = () => ({ | |
clickableCard: { | |
style: { | |
height: 'auto', | |
width: '100%', | |
margin: '0px', | |
padding: '0px' | |
} | |
}, | |
cardStyle: { | |
style: { | |
height: '100%', | |
flex: '1' | |
}, | |
containerStyle: { | |
height: '100%', | |
display: 'flex', | |
flexDirection: 'column' | |
} | |
}, | |
}); | |
class ClickableCard extends React.Component { | |
// ... do props checks ... | |
// ... events .... | |
render(){ | |
const styles = getStyles(); | |
return ( | |
<RaisedButton | |
style={{ | |
...styles.clickableCard.style, | |
...this.props.style | |
}} | |
{/* define button action */} | |
> | |
<Card | |
className={this.props.className} | |
style={styles.cardStyle.style} | |
containerStyle={Object.assign(styles.cardStyle.containerStyle, this.props.containerStyle)}> | |
{/* --- Card childs --- */} | |
</Card> | |
</RaisedButton> | |
); | |
} | |
} | |
export default ClickableCard; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TypeError: Cannot read property 'displayName' of undefined
at getDisplayName (ReactComponentTreeHook.js:152)
at Object.getCurrentStackAddendum (ReactComponentTreeHook.js:262)
at validateExplicitKey (ReactElementValidator.js:103)
at validateChildKeys (ReactElementValidator.js:123)
at Object.createElement (ReactElementValidator.js:209)
at HomeScreenCards.render (HomeScreenCards.js:48)
at ReactCompositeComponent.js:796
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:795)
at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:822)
client.js:58 [HMR] connected