saleor-dashboard/src/components/ResponsiveTable/ResponsiveTable.tsx
dominik-zeglen 77982d9c35 Sort imports
2019-11-19 13:48:46 +01:00

44 lines
926 B
TypeScript

import makeStyles from "@material-ui/core/styles/makeStyles";
import Table from "@material-ui/core/Table";
import React from "react";
const useStyles = makeStyles(
theme => ({
root: {
[theme.breakpoints.up("sm")]: {
"& table": {
tableLayout: "fixed"
}
},
"& table": {
tableLayout: "auto"
},
overflowX: "auto",
width: "100%"
}
}),
{
name: "ResponsiveTable"
}
);
interface ResponsiveTableProps {
children: React.ReactNode | React.ReactNodeArray;
className?: string;
key?: string;
}
const ResponsiveTable: React.FC<ResponsiveTableProps> = props => {
const { children, className } = props;
const classes = useStyles(props);
return (
<div className={classes.root}>
<Table className={className}>{children}</Table>
</div>
);
};
ResponsiveTable.displayName = "ResponsiveTable";
export default ResponsiveTable;