* build: create profile plugin page * build: add plugins folder to Profile * build: wrap Profile Plugin Page with Plugin Co-authored-by: Jason Wesson <jwesson@2u.com>
43 lines
951 B
JavaScript
43 lines
951 B
JavaScript
'use client';
|
|
|
|
import React from 'react';
|
|
|
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
import PluginContainerIframe from './PluginContainerIframe';
|
|
|
|
import {
|
|
IFRAME_PLUGIN,
|
|
} from './data/constants';
|
|
import { pluginConfigShape } from './data/shapes';
|
|
|
|
// eslint-disable-next-line react/function-component-definition
|
|
export default function PluginContainer({ config, ...props }) {
|
|
if (config === null) {
|
|
return null;
|
|
}
|
|
|
|
// this will allow for future plugin types to be inserted in the PluginErrorBoundary
|
|
let renderer = null;
|
|
switch (config.type) {
|
|
case IFRAME_PLUGIN:
|
|
renderer = (
|
|
<PluginContainerIframe config={config} {...props} />
|
|
);
|
|
break;
|
|
// istanbul ignore next: default isn't meaningful, just satisfying linter
|
|
default:
|
|
}
|
|
|
|
return (
|
|
renderer
|
|
);
|
|
}
|
|
|
|
PluginContainer.propTypes = {
|
|
config: pluginConfigShape,
|
|
};
|
|
|
|
PluginContainer.defaultProps = {
|
|
config: null,
|
|
};
|