ContentLayout.tsx 1.15 KB
Newer Older
Oleksii Savran's avatar
Oleksii Savran committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as React from 'react';

import { withStyles } from '@material-ui/core/styles';

import SidebarWrapper from './sidebar/SidebarWrapper';

const styles = (theme) => ({
  root: {
    display: 'flex' as 'flex',
    flexDirection: 'row' as 'row',
    width: '100%',
    minHeight: '400px',
  },
  main: {
    width: '100%',
    height: '100%',
  },
});

interface IContentLayoutProps extends React.Props<any> {
  classes?: any;
  children?: any;
  left?: any;
  right?: any;
  className?: string;
  customHeaderHeight?: boolean;
}

const ContentLayout = ({classes, children = null, left = null, right = null, customHeaderHeight = false, className = ''}: IContentLayoutProps) => {
  return (
    <div className={ className }>
      <div className={ classes.root }>
        { left && (<SidebarWrapper sidebarContent={ left } customHeight={ customHeaderHeight }/>) }
        { children && (
          <main className={ classes.main }>
            { children }
          </main>
        ) }
        { right && (<SidebarWrapper sidebarContent={ right } customHeight={ customHeaderHeight }/>) }
      </div>
    </div>
  );
};

export default withStyles(styles)(ContentLayout);