import { AutoType } from "@griddo/core"; import * as React from "react"; // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // GriddoCoreComponent is a closure function component that wraps a list of // modules with Griddo utilities, for example wrappers required for display in // the Griddo page editor. // It is necessary to go through this component only in those that we want said // functionalities. // ----------------------------------------------------------------------------- // eslint-disable-next-line import/order import { GriddoCoreComponent } from "../components/GriddoCoreComponent"; // ----------------------------------------------------------------------------- // Import React modules // ----------------------------------------------------------------------------- // We import the modules with React.lazy to get code splitting in the // builder and shrink the bundle. // ----------------------------------------------------------------------------- const CardCollection = React.lazy(() => import("./CardCollection")); // ----------------------------------------------------------------------------- // Whitelist modules for // ----------------------------------------------------------------------------- // Generate a modules object to pass to as a valid list of // components of the instance that we need to select or interact with them in // the editor. // ----------------------------------------------------------------------------- const modules = { CardCollection }; // ----------------------------------------------------------------------------- // Whitelist types for // ----------------------------------------------------------------------------- // We create an union type with all the props to pass it to , // that way way when we use if we pass it the component prop // we will have autocompletion and safe access to the props of said component. // ----------------------------------------------------------------------------- type ModulesProps = AutoType.CardCollection; // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // This closure function returns the modules that are passed through the props // libComponents, wrapped with functionality needed by the editor Griddo pages. // ----------------------------------------------------------------------------- const GriddoModule = (props: ModulesProps) => { const { component } = props; return ( ); }; // ----------------------------------------------------------------------------- // Module named export // ----------------------------------------------------------------------------- export { CardCollection, GriddoModule }; // ----------------------------------------------------------------------------- // Griddo bundle export // ----------------------------------------------------------------------------- export default modules;