2019-11-04 20:31:49 +00:00
|
|
|
import makeStyles from "@material-ui/core/styles/makeStyles";
|
2019-11-13 13:00:53 +00:00
|
|
|
import Table from "@material-ui/core/Table";
|
2019-11-04 10:47:57 +00:00
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
const useStyles = makeStyles(
|
2019-11-04 20:31:49 +00:00
|
|
|
theme => ({
|
2019-11-04 10:47:57 +00:00
|
|
|
root: {
|
2019-11-04 20:31:49 +00:00
|
|
|
[theme.breakpoints.up("sm")]: {
|
|
|
|
"& table": {
|
|
|
|
tableLayout: "fixed"
|
|
|
|
}
|
|
|
|
},
|
2019-11-04 14:24:48 +00:00
|
|
|
"& table": {
|
|
|
|
tableLayout: "auto"
|
|
|
|
},
|
2019-11-04 20:31:49 +00:00
|
|
|
overflowX: "auto",
|
|
|
|
width: "100%"
|
2019-11-04 10:47:57 +00:00
|
|
|
}
|
|
|
|
}),
|
|
|
|
{
|
|
|
|
name: "ResponsiveTable"
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2019-11-04 14:24:48 +00:00
|
|
|
interface ResponsiveTableProps {
|
|
|
|
children: React.ReactNode | React.ReactNodeArray;
|
|
|
|
className?: string;
|
|
|
|
key?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ResponsiveTable: React.FC<ResponsiveTableProps> = props => {
|
2019-11-04 20:31:49 +00:00
|
|
|
const { children, className } = props;
|
2019-11-04 10:47:57 +00:00
|
|
|
|
|
|
|
const classes = useStyles(props);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={classes.root}>
|
2019-11-04 20:31:49 +00:00
|
|
|
<Table className={className}>{children}</Table>
|
2019-11-04 10:47:57 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ResponsiveTable.displayName = "ResponsiveTable";
|
|
|
|
export default ResponsiveTable;
|