@@ -31,9 +31,26 @@ const useStyles = makeStyles()((theme) => ({
31
31
'&:hover' : {
32
32
background : theme . palette . action . hover ,
33
33
} ,
34
+ display : 'flex' ,
35
+ alignItems : 'center' ,
36
+ justifyContent : 'center' ,
34
37
} ,
35
38
accordionRoot : {
36
- background : theme . palette . background . paper ,
39
+ background : theme . palette . divider ,
40
+ } ,
41
+ resizeHandle : {
42
+ width : '100%' ,
43
+ height : 4 ,
44
+ position : 'absolute' ,
45
+ cursor : 'row-resize' ,
46
+ zIndex : 100 ,
47
+ } ,
48
+ expandIcon : {
49
+ // position: 'relative',
50
+ } ,
51
+ title : {
52
+ // position: 'relative',
53
+ userSelect : 'none' ,
37
54
} ,
38
55
} ) )
39
56
@@ -60,6 +77,7 @@ const ResizeHandle = ({
60
77
} : {
61
78
onResize : ( sizeDelta : number ) => void
62
79
} ) => {
80
+ const { classes } = useStyles ( )
63
81
const mouseMove = useCallback (
64
82
( event : MouseEvent ) => {
65
83
event . stopPropagation ( )
@@ -92,13 +110,7 @@ const ResizeHandle = ({
92
110
e . stopPropagation ( )
93
111
e . preventDefault ( )
94
112
} }
95
- style = { {
96
- width : '100%' ,
97
- height : '4px' ,
98
- position : 'absolute' ,
99
- cursor : 'row-resize' ,
100
- zIndex : 100 ,
101
- } }
113
+ className = { classes . resizeHandle }
102
114
/>
103
115
)
104
116
}
@@ -117,18 +129,18 @@ const AccordionControl = observer(function AccordionControl({
117
129
const { classes } = useStyles ( )
118
130
return (
119
131
< div className = { classes . accordionRoot } >
132
+ { open && onResize ? < ResizeHandle onResize = { onResize } /> : null }
120
133
{ /* TODO: a11y */ }
121
134
{ /* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */ }
122
135
< div className = { classes . accordionControl } onClick = { onClick } >
123
- { open && onResize ? < ResizeHandle onResize = { onResize } /> : null }
124
136
{ open ? (
125
- < ExpandLessIcon sx = { { position : 'relative' , top : - 4 } } />
137
+ < ExpandLessIcon className = { classes . expandIcon } />
126
138
) : (
127
- < ExpandMoreIcon sx = { { position : 'relative' , top : - 4 } } />
139
+ < ExpandMoreIcon className = { classes . expandIcon } />
128
140
) }
129
141
{ title ? (
130
142
< Typography
131
- sx = { { position : 'relative' , top : - 11 , userSelect : 'none' } }
143
+ className = { classes . title }
132
144
variant = "caption"
133
145
component = "span"
134
146
>
@@ -150,11 +162,15 @@ export const DisplayComponent = observer(function DisplayComponent({
150
162
151
163
const {
152
164
height : overallHeight ,
165
+ heightPreConfig,
153
166
isShown,
154
167
selectedFeature,
155
168
tabularEditor,
156
169
toggleShown,
157
170
} = model
171
+ if ( ! heightPreConfig ) {
172
+ model . setHeight ( 500 )
173
+ }
158
174
const detailsHeight = tabularEditor . isShown ? model . detailsHeight : 0
159
175
const featureAreaHeight = isShown
160
176
? overallHeight - detailsHeight - accordionControlHeight * 2
@@ -169,14 +185,8 @@ export const DisplayComponent = observer(function DisplayComponent({
169
185
( ) => scrollSelectedFeatureIntoView ( model , canvasScrollContainerRef ) ,
170
186
[ model , selectedFeature ] ,
171
187
)
172
- const headerStyle = {
173
- display : 'flex' ,
174
- justifyContent : 'center' ,
175
- alignItems : 'center' ,
176
- background : 'turquoise' ,
177
- }
178
188
return (
179
- < div style = { { height : overallHeight } } >
189
+ < div className = { classes . details } style = { { height : overallHeight } } >
180
190
< AccordionControl
181
191
open = { isShown }
182
192
title = "Graphical"
@@ -189,15 +199,13 @@ export const DisplayComponent = observer(function DisplayComponent({
189
199
>
190
200
< LinearApolloDisplay model = { model } { ...other } />
191
201
</ div >
192
- < div style = { headerStyle } >
193
- < AccordionControl
194
- title = "Table"
195
- open = { tabularEditor . isShown }
196
- onClick = { tabularEditor . togglePane }
197
- onResize = { onDetailsResize }
198
- />
199
- </ div >
200
- < div className = { classes . details } style = { { height : detailsHeight } } >
202
+ < AccordionControl
203
+ title = "Table"
204
+ open = { tabularEditor . isShown }
205
+ onClick = { tabularEditor . togglePane }
206
+ onResize = { onDetailsResize }
207
+ />
208
+ < div style = { { height : detailsHeight } } >
201
209
< TabularEditorPane model = { model } />
202
210
</ div >
203
211
</ div >
0 commit comments