redgeoff/mson

[Question] Application without Menu as root

PatelVishalJ opened this issue · 1 comments

I want to have an application not having Menu as a root component.

Is it feasible? I gave some try, but did not work. Below is one example:

import { render } from "mson-react";
import compiler from "mson/lib/compiler";
import "typeface-roboto";

compiler.registerComponent("MyForm",{
  name: "MyForm",
  component: "Form",
  fields: [
    {
      name: "task",
      component: "TextField",
      label: "Task",
      multiline: true,
      required: true
    },
    {
      name: "due",
      component: "DateField",
      label: "Due"
    }
  ]
});

const app = compiler.newComponent({
    component: 'MyForm'
});

render(app); 

I am referring to https://github.com/redgeoff/mson/blob/master/src/app.js. Looks like there must be a Menu as a root component. Please suggest if any workaround.

This can be done by setting fullScreen to true in the menu item, e.g.

import { render } from "mson-react";
import compiler from "mson/lib/compiler";
import "typeface-roboto";

const app = compiler.newComponent({
  component: "App",
  menu: {
    component: "Menu",
    items: [
      {
        path: "/",
        label: "My Form",
        fullScreen: true,
        content: {
          component: "Form",
          fields: ...
        }
      }
    ]
  }
});

render(app);

See https://codesandbox.io/s/w00kmwwn2l for a working example