Allow empty slots for rightPanels and leftPanels

This commit is contained in:
dannyrb 2020-05-26 09:02:47 -04:00
parent 60c4a36cc5
commit fae21bed9c

View File

@ -135,11 +135,13 @@ function ViewerLayout({
style={{ height: 'calc(100vh - 57px' }} style={{ height: 'calc(100vh - 57px' }}
> >
{/* LEFT SIDEPANELS */} {/* LEFT SIDEPANELS */}
<SidePanel {leftPanelComponents.length && (
side="left" <SidePanel
defaultComponentOpen={leftPanelComponents[0].name} side="left"
childComponents={leftPanelComponents} defaultComponentOpen={leftPanelComponents[0].name}
/> childComponents={leftPanelComponents}
/>
)}
{/* TOOLBAR + GRID */} {/* TOOLBAR + GRID */}
<div className="flex flex-col flex-1 h-full"> <div className="flex flex-col flex-1 h-full">
<div className="flex h-12 border-b border-transparent flex-2 w-100"> <div className="flex h-12 border-b border-transparent flex-2 w-100">
@ -206,11 +208,13 @@ function ViewerLayout({
/>*/} />*/}
</div> </div>
</div> </div>
<SidePanel {rightPanelComponents.length && (
side="right" <SidePanel
defaultComponentOpen={rightPanelComponents[0].name} side="right"
childComponents={rightPanelComponents} defaultComponentOpen={rightPanelComponents[0].name}
/> childComponents={rightPanelComponents}
/>
)}
</div> </div>
</div> </div>
); );
@ -237,4 +241,9 @@ ViewerLayout.propTypes = {
children: PropTypes.oneOfType(PropTypes.node, PropTypes.func).isRequired, children: PropTypes.oneOfType(PropTypes.node, PropTypes.func).isRequired,
}; };
ViewerLayout.defaultProps = {
leftPanels: [],
rightPanels: [],
};
export default ViewerLayout; export default ViewerLayout;