Skip to content

Instantly share code, notes, and snippets.

@aderbas
Created May 12, 2020 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aderbas/cb3f7a098c218d432b068b2b246d37ea to your computer and use it in GitHub Desktop.
Save aderbas/cb3f7a098c218d432b068b2b246d37ea to your computer and use it in GitHub Desktop.
Custom box area
/**
* Javascript File
* @author: Aderbal Nunes <aderbalnunes@gmail.com>
* @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