Created
May 12, 2020 13:17
-
-
Save aderbas/cb3f7a098c218d432b068b2b246d37ea to your computer and use it in GitHub Desktop.
Custom box area
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
/** | |
* Javascript File | |
* @author: Aderbal Nunes <[email protected]> | |
* @since: 12/05/2020 | |
* | |
* | |
* props: { | |
* border: 2, | |
* borderColor: '#990099', | |
* borderStyle: 'solid', | |
* backgroundColor: '#FFF', | |
* borderRadius: 3, | |
* padding: 8, | |
* margin: 2, | |
* child: { | |
* component: <Component>, | |
* props: { | |
* ... | |
* } | |
* } | |
* } | |
* | |
*/ | |
import React, { Component } from 'react'; | |
class BoxArea extends Component{ | |
render(){ | |
const {child, ...styles} = this.props; | |
return ( | |
<div style={styles}> | |
{child | |
? React.createElement(child.component, child.props) | |
: null | |
} | |
</div> | |
); | |
}; | |
} | |
export default BoxArea; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment