import React from "react"; import classnames from "classnames"; import { Paper, IconButton, Menu, MenuItem, withStyles } from "@material-ui/core"; import { MoreVert as MoreIcon } from "@material-ui/icons"; import Typography from "@material-ui/core/es/Typography/Typography"; const Widget = ({ classes, children, title, noBodyPadding, bodyClass, className, disableWidgetMenu, ...props }) => (
{props.header ? ( props.header ) : ( {title} {!disableWidgetMenu && ( props.setMoreMenuOpen(true)} ref={props.setMoreButtonRef} > )} )}
{children}
props.setMoreMenuOpen(false)} disableAutoFocusItem > Edit Copy Delete Print
); const styles = (theme) => ({ widgetWrapper: { display: "flex", minHeight: "100%" }, widgetHeader: { padding: theme.spacing.unit * 3, paddingBottom: theme.spacing.unit, display: "flex", justifyContent: "space-between", alignItems: "center" }, widgetRoot: { boxShadow: theme.customShadows.widget }, widgetBody: { paddingBottom: theme.spacing.unit * 3, paddingRight: theme.spacing.unit * 3, paddingLeft: theme.spacing.unit * 3 }, noPadding: { padding: 0 }, paper: { display: "flex", flexDirection: "column", flexGrow: 1, overflow: "hidden" }, moreButton: { margin: -theme.spacing.unit, padding: 0, width: 40, height: 40, color: theme.palette.text.hint, "&:hover": { backgroundColor: theme.palette.primary.main, color: "rgba(255, 255, 255, 0.35)" } } }); export default withStyles(styles, { withTheme: true })(Widget);