import * as React from "react"; import _ from "lodash"; import WebFontLoader from "webfontloader"; import * as Tools from "@sc/modules/page/Builder/Properties"; import { GeneratorProps } from "./types"; export const Generator: React.FC = (props) => { const { data } = props; const { main } = data; const { tabs } = main; WebFontLoader.load({ google: { families: ["Material Icons"], }, }); return ( ({ id: key, title: itm, component: key ? GenerateSecondTab : GenerateFirstTab, }))} /> ); }; const GenerateTab = (props) => { const { data, tab } = props; const { main } = data; const { sections } = main; const filteredSections = tab === "" ? sections : sections.filter((itm) => _.get(itm, "tab", tab) === tab); return (
{filteredSections.map((section, key) => { const { type, settings } = section; let Component = _.has(Tools, type) ? Tools[type] : () => ( ); // Add Section Wrapper if required if (_.has(section, "sectionWrap")) { return ( ); } else { return ; } })}
); }; const GenerateFirstTab = (props) => ( ); const GenerateSecondTab = (props) => ( ); export default Generator;