11import React from 'react'
22import Grid from '@material-ui/core/Grid'
33import { makeStyles } from '@material-ui/core/styles'
4- import Paper from '@material-ui/core/Paper'
5- import { bgDark } from '../../theme'
4+ import Card from '@material-ui/core/Card' ;
5+ import CardContent from '@material-ui/core/CardContent' ;
66
7- const useStyles = makeStyles ( ( { spacing, palette } ) => ( {
8- container :{ height : 'calc(100% - 8px)' , alignItems : 'stretch' } ,
9- grid : {
10- flex : '1 0 0' ,
11- minWidth : 400 ,
12- minHeight : 350 ,
13- maxHeight : '100%' ,
14- marginRight : spacing ( 1 ) ,
15- marginBottom : spacing ( 1 )
16- } ,
17- paper : { height : '100%' , backgroundColor : bgDark } ,
18- root : { height : '100%' , overflowY : 'visible' , overflowX : 'hidden' , marginRight : - spacing ( 1 ) }
19- } ) )
7+ const useStyles = makeStyles ( ( { spacing, palette } ) => ( { } ) )
208
219export default function GridLayout ( { children } ) {
2210 const classes = useStyles ( )
2311 // left-hand-side-top - left-hand-side-bottom - right-hand-side - others
2412 const [ lhst , lhsb , rhs , ...others ] = children
2513 return (
2614 < div className = { classes . root } >
27- < Grid container className = { classes . container } alignItems = "flex-start " >
15+ < Grid container elevation = { 0 } spacing = { 1 } alignItems = "stretch " >
2816
29- < Grid item className = { classes . grid } >
30- < Paper className = { classes . paper } >
31- < SingleComponent >
17+ < Grid item >
18+ < Card elevation = { 0 } >
19+ < CardContent >
3220 { lhst }
3321 { lhsb }
34- </ SingleComponent >
35- </ Paper >
22+ </ CardContent >
23+ </ Card >
3624
3725 </ Grid >
3826
39- < Grid item className = { classes . grid } >
40- < Paper className = { classes . paper } >
41- < SingleComponent >
42- { [ rhs ] }
43- </ SingleComponent >
44- </ Paper >
45- </ Grid >
46-
27+ { rhs
28+ ? < Grid item >
29+ < Card elevation = { 0 } >
30+ < CardContent >
31+ { [ rhs ] }
32+ </ CardContent >
33+ </ Card >
34+ </ Grid > : ''
35+ }
4736 </ Grid >
4837 { others }
4938 </ div >
5039
5140 )
5241}
53-
54- const useComponentStyles = makeStyles ( ( { spacing } ) => ( {
55- container : {
56- display : 'flex' ,
57- flexDirection : 'column' ,
58- height : '100%' ,
59- margin : `0px ${ spacing ( 1 ) } px` ,
60- paddingTop : spacing ( 1 )
61- } ,
62- element : {
63- overflowY :'auto' ,
64- overflowX :'hidden' ,
65- maxHeight : '100%' ,
66- // height: '100%'
67- }
68- } ) )
69-
70- function SingleComponent ( { children = [ ] } ) {
71- const classes = useComponentStyles ( )
72- const [ topChild , ...otherChildren ] = children
73-
74- return (
75- < div className = { classes . container } >
76- < div >
77- { otherChildren . length > 0 ? topChild : null }
78- </ div >
79-
80- < div className = { classes . element } >
81- { otherChildren . length > 0 ? otherChildren : topChild }
82- </ div >
83- </ div >
84- )
85-
86- }
0 commit comments