File "withDynamicContent.js"
Full path: /home/webcknlt/admissiontell.com/wp-content/plugins/generateblocks/src/extend/dynamic-content/hoc/withDynamicContent.js
File
size: 723 B (723 B bytes)
MIME-type: text/x-java
Charset: utf-8
Download Open Edit Advanced Editor &nnbsp; Back
import { Fragment } from '@wordpress/element';
import InspectorControls from '../InspectorControls';
import DynamicRenderer from '../DynamicRenderer';
export default ( WrappedComponent ) => {
return ( props ) => {
const { attributes, setAttributes, context, name } = props;
const newProps = attributes.useDynamicData &&
( !! attributes.dynamicContentType || !! attributes.dynamicLinkType )
? Object.assign( {}, props, {
ContentRenderer: DynamicRenderer,
} ) : props;
return (
<Fragment>
<WrappedComponent { ...newProps } />
<InspectorControls
context={ context }
attributes={ attributes }
setAttributes={ setAttributes }
name={ name }
/>
</Fragment>
);
};
};