import React from 'react';
import Sidebar from '../sidebar/Sidebar';
import { useSidebarContext } from '../sidebar/SidebarContext';

const DocumentsLayout = ({ sidebarProps, children }) => {
  const { collapsed, sidebarSuppressed } = useSidebarContext();
  const sidebarHidden = collapsed || sidebarSuppressed;
  return (
    <main className={`documents-main${sidebarHidden ? ' documents-main--sidebar-hidden' : ''}`}>
      {!sidebarHidden ? <Sidebar {...sidebarProps} /> : null}
      {children}
    </main>
  );
};

export default DocumentsLayout;
