import * as React from "react"; import * as Component from "@sc/plugins/webcomponents/v2"; import { ComponentTypes } from "@sc/plugins/webcomponents/v2/types"; import { EditorMode } from "@sc/modules/v2/Editor/types"; // const Component: any = { // Body: ({ children }) =>
{children}
, // Text: () =>

Text

, // Headline: () =>

HEADLINE

, // }; import { Menu, MenuItem, Button } from "@material-ui/core"; interface LoadComponentProps { /** * enum(LIVE,EDITOR) */ mode?: EditorMode; /** * The name of the component that should be loaded */ type: ComponentTypes; /** * The settings to pass along to the component */ settings?: any; /** * Mobile responsive settings */ rSettings?: object; /** * Whether or not the component is currently being dragged */ // isDragInProgress?: Boolean; children?: React.ReactNode; } /** * (Formerly WebComponent) The react component used to interpret each item in the editor. */ export const LoadComponent: React.FC = ({ mode = EditorMode.LIVE, // isDragInProgress = false, type, settings = {}, children, }) => { // const RenderedComponent: React.FC = Component[type]; // return ( // // {children} // // ); // const components = Object.keys(ComponentTypes); return React.createElement(Component[type], { ...settings, children, mode, }); }; export default LoadComponent;