11import React , { useEffect } from 'react' ;
22import Helmet from 'react-helmet' ;
33import { Link } from '@reach/router' ;
4- import TableContainer from '@material-ui/core/TableContainer' ;
54import Paper from '@material-ui/core/Paper' ;
65import Table from '@material-ui/core/Table' ;
76import TableBody from '@material-ui/core/TableBody' ;
@@ -14,13 +13,30 @@ import { useSelector, useDispatch } from 'react-redux';
1413import Container from '@material-ui/core/Container' ;
1514import SyntaxHighlighter from 'react-syntax-highlighter' ;
1615import { docco } from 'react-syntax-highlighter/dist/esm/styles/hljs' ;
16+ import { makeStyles } from "@material-ui/core/styles" ;
17+
18+ const useStyles = makeStyles ( ( theme ) => ( {
19+ grow : {
20+ flexGrow : 1 ,
21+ } ,
22+ paper : {
23+ flexGrow : 1 ,
24+ display : "flex" ,
25+ overflowX : "auto"
26+ } ,
27+ table : {
28+ minWidth : 800
29+ }
30+ } ) ) ;
1731
1832function ApiReference ( props ) {
1933 const { fileName } = props ;
2034 const loaded = useSelector ( state => state . reference . files [ fileName ] && state . reference . files [ fileName ] . loaded ) ;
2135 const markdown = useSelector ( state => state . reference . files [ fileName ] && state . reference . files [ fileName ] . markdown ) ;
2236 const dispatch = useDispatch ( )
2337
38+ const classes = useStyles ( ) ;
39+
2440 useEffect ( ( ) => {
2541 if ( ! loaded ) {
2642 dispatch ( load ( fileName ) ) ;
@@ -52,7 +68,7 @@ function ApiReference(props) {
5268 }
5369 break ;
5470 case 'table' :
55- return < Paper style = { { overflowX : "auto" } } > < Table style = { { minWidth : 640 } } key = { key } > { children } </ Table > </ Paper > ;
71+ return < Paper className = { classes . paper } > < Table className = { classes . table } key = { key } > { children } </ Table > </ Paper > ;
5672 case 'tbody' :
5773 return < TableBody key = { key } > { children } </ TableBody > ;
5874 case 'thead' :
@@ -73,7 +89,7 @@ function ApiReference(props) {
7389 case 'td' :
7490 return < TableCell key = { key } > { children } </ TableCell > ;
7591 case 'span' :
76- return < Container maxWidth = { false } > { children } </ Container > ;
92+ return < Container className = { classes . grow } > { children } </ Container > ;
7793 default :
7894 break ;
7995 }
0 commit comments