@@ -18,6 +18,9 @@ import Box from '@material-ui/core/Box';
18
18
import LinkIcon from '@material-ui/icons/Link' ;
19
19
import Button from '@material-ui/core/Button' ;
20
20
import ButtonGroup from '@material-ui/core/ButtonGroup' ;
21
+ import ExpandMoreIcon from '@material-ui/icons/ExpandMore' ;
22
+ import CardHeader from '@material-ui/core/CardHeader' ;
23
+ import IconButton from '@material-ui/core/IconButton' ;
21
24
22
25
import Link from 'next/link' ;
23
26
import clsx from 'clsx' ;
@@ -133,6 +136,24 @@ const useStyles = makeStyles((theme) => ({
133
136
hidden : {
134
137
height : 0 ,
135
138
minHeight : 0
139
+ } ,
140
+ expand : {
141
+ transform : 'rotate(-90deg)'
142
+ } ,
143
+ hide : {
144
+ transform : 'rotate(90deg)'
145
+ } ,
146
+ tableHeader : {
147
+ paddingBottom : 0 ,
148
+ [ theme . breakpoints . down ( 'sm' ) ] : {
149
+ display : 'none'
150
+ }
151
+ } ,
152
+ tableBody : {
153
+ paddingTop : 0
154
+ } ,
155
+ expandButton : {
156
+ width : '100%'
136
157
}
137
158
} ) ) ;
138
159
@@ -144,6 +165,7 @@ const stringifyWithFunctions = (string) =>
144
165
145
166
const ComponentExample = ( { variants, schema, activeMapper, component, schemaVariants } ) => {
146
167
const [ variant , setVariant ] = useState ( 'basic' ) ;
168
+ const [ expanded , setExpanded ] = useState ( true ) ;
147
169
148
170
const { pathname, push } = useRouter ( ) ;
149
171
const classes = useStyles ( ) ;
@@ -204,28 +226,39 @@ const ComponentExample = ({ variants, schema, activeMapper, component, schemaVar
204
226
return (
205
227
< React . Fragment >
206
228
< Box display = "flex" className = { classes . box } >
207
- < Card style = { { minHeight : 500 } } square >
208
- < CardContent >
209
- < Table >
210
- < TableHead >
211
- < TableRow >
212
- < TableCell > Name</ TableCell >
213
- < TableCell > Type</ TableCell >
214
- < TableCell > Required</ TableCell >
215
- </ TableRow >
216
- </ TableHead >
217
- < TableBody >
218
- { variants . map ( ( { name, type, required } ) => (
219
- < TableRow key = { name } >
220
- < TableCell > { name } </ TableCell >
221
- < TableCell > { `${ type } ` } </ TableCell >
222
- < TableCell > { required && < CheckIcon fontSize = "small" /> } </ TableCell >
229
+ { expanded && (
230
+ < Card style = { { minHeight : 500 } } square >
231
+ < CardHeader
232
+ className = { clsx ( classes . tableHeader ) }
233
+ title = { expanded ? 'Options' : '' }
234
+ action = {
235
+ < IconButton aria-label = "hide options" onClick = { ( ) => setExpanded ( ! expanded ) } >
236
+ < ExpandMoreIcon className = { classes . hide } />
237
+ </ IconButton >
238
+ }
239
+ />
240
+ < CardContent className = { classes . tableBody } >
241
+ < Table >
242
+ < TableHead >
243
+ < TableRow >
244
+ < TableCell > Name</ TableCell >
245
+ < TableCell > Type</ TableCell >
246
+ < TableCell > Required</ TableCell >
223
247
</ TableRow >
224
- ) ) }
225
- </ TableBody >
226
- </ Table >
227
- </ CardContent >
228
- </ Card >
248
+ </ TableHead >
249
+ < TableBody >
250
+ { variants . map ( ( { name, type, required } ) => (
251
+ < TableRow key = { name } >
252
+ < TableCell > { name } </ TableCell >
253
+ < TableCell > { `${ type } ` } </ TableCell >
254
+ < TableCell > { required && < CheckIcon fontSize = "small" /> } </ TableCell >
255
+ </ TableRow >
256
+ ) ) }
257
+ </ TableBody >
258
+ </ Table >
259
+ </ CardContent >
260
+ </ Card >
261
+ ) }
229
262
< Box display = "flex" className = { classes . editorContainer } >
230
263
< div className = { classes . smTabDown } >
231
264
< Tabs
@@ -240,6 +273,11 @@ const ComponentExample = ({ variants, schema, activeMapper, component, schemaVar
240
273
</ Tabs >
241
274
</ div >
242
275
< div className = { classes . smTabUp } >
276
+ { ! expanded && (
277
+ < IconButton className = { classes . expandButton } aria-label = "expand options" onClick = { ( ) => setExpanded ( ! expanded ) } >
278
+ < ExpandMoreIcon className = { classes . expand } />
279
+ </ IconButton >
280
+ ) }
243
281
< Tabs
244
282
value = { activeMapper }
245
283
orientation = "vertical"
0 commit comments