1
0
Fork 0

fix(lab): Layout improvements

This commit is contained in:
Joost De Cock 2022-05-14 14:53:29 +02:00
parent ed535bbe8c
commit 2c5f0fa332
17 changed files with 75 additions and 120 deletions

View file

@ -55,10 +55,10 @@ const hasRequiredMeasurements = (pattern, gist) => {
/*
* This component wraps the workbench and is in charge of
* keeping the gist state, which will trickly down
* keeping the gist state, which will trickle down
* to all workbench subcomponents
*/
const WorkbenchWrapper = ({ app, pattern, preload=false, from=false }) => {
const WorkbenchWrapper = ({ app, pattern, preload=false, from=false, layout=false }) => {
// State for gist
const [gist, setGist] = useLocalStorage(`${pattern.config.name}_gist`, defaultGist(pattern, app.locale))
@ -128,14 +128,19 @@ const WorkbenchWrapper = ({ app, pattern, preload=false, from=false }) => {
AltMenu: <Menu {...componentProps }/>
}
// Layout to use
const LayoutComponent = layout
? layout
: Layout
const Component = views[gist?._state?.view]
? views[gist._state.view]
: views.welcome
return <Layout {...layoutProps}>
return <LayoutComponent {...layoutProps}>
{messages}
<Component {...componentProps} />
</Layout>
</LayoutComponent>
}
export default WorkbenchWrapper