mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +00:00
Remove useless compo
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
b695cabb32
commit
e4b45bc14e
@ -35,7 +35,6 @@ export default {
|
||||
mainComponent: App,
|
||||
name,
|
||||
pluginLogo,
|
||||
preventComponentRendering: false,
|
||||
trads,
|
||||
});
|
||||
},
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* ExtendComponent
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { get, isEmpty } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
class ExtendComponent extends React.Component {
|
||||
getInjectedComponent = () =>
|
||||
this.context.plugins.reduce((acc, plugin) => {
|
||||
if (!isEmpty(plugin.toJS().injectedComponents)) {
|
||||
const injectedComponents = plugin
|
||||
.toJS()
|
||||
.injectedComponents.filter(
|
||||
compo =>
|
||||
compo.plugin === this.props.plugin &&
|
||||
compo.container === this.props.container &&
|
||||
compo.area === this.props.area
|
||||
);
|
||||
|
||||
return injectedComponents[0];
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
render() {
|
||||
const Component = get(this.getInjectedComponent(), 'injectedComponent');
|
||||
const renderedComponent = Component ? <Component {...this.props} /> : '';
|
||||
|
||||
return <div>{renderedComponent}</div>;
|
||||
}
|
||||
}
|
||||
|
||||
ExtendComponent.contextTypes = {
|
||||
plugins: PropTypes.object,
|
||||
router: PropTypes.object,
|
||||
updatePlugin: PropTypes.func,
|
||||
};
|
||||
|
||||
ExtendComponent.defaultProps = {
|
||||
children: <div />,
|
||||
};
|
||||
|
||||
ExtendComponent.propTypes = {
|
||||
area: PropTypes.string.isRequired,
|
||||
children: PropTypes.node,
|
||||
container: PropTypes.string.isRequired,
|
||||
plugin: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default ExtendComponent;
|
||||
@ -16,7 +16,6 @@ export { default as Carret } from './components/Carret';
|
||||
export { default as CircleButton } from './components/CircleButton';
|
||||
export { default as ContainerFluid } from './components/ContainerFluid';
|
||||
export { default as ErrorBoundary } from './components/ErrorBoundary';
|
||||
export { default as ExtendComponent } from './components/ExtendComponent';
|
||||
export { default as ErrorFallback } from './components/ErrorFallback';
|
||||
export { default as FilterButton } from './components/FilterButton';
|
||||
export { default as GlobalPagination } from './components/GlobalPagination';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user