import { Component, createRef } from 'react';
import Box from '@mui/material/Box';
import CircularProgress from '@mui/material/CircularProgress';
import IconButton from '@mui/material/IconButton';
import Paper from '@mui/material/Paper';
import Typography from '@mui/material/Typography';
import SaveOutlinedIcon from '@mui/icons-material/SaveOutlined';
import { injectMuiTheme } from './injectMuiTheme';
import {
GRID_COLUMNS,
TILE_ACTION_PADDING,
panelTilePaperSx,
tileActionIconSx,
tileActionSx,
} from './panelTileLayout';
class PanelTileBase extends Component {
renderTitle() {
const { title, action } = this.props;
if (!title) return null;
return (
{title}
);
}
renderAction() {
const { action } = this.props;
if (!action) return null;
const { label, icon: Icon, onClick, busy } = action;
return (
<>
{busy ? (
) : (
)}
>
);
}
render() {
const {
theme,
wide = 1,
children,
sx,
minHeight = 120,
tileKey,
action,
elevation = 4,
} = this.props;
const actionPadding = action ? TILE_ACTION_PADDING : 0;
return (
{this.renderAction()}
{this.renderTitle()}
{children}
);
}
}
export const PanelTile = injectMuiTheme(PanelTileBase);
export function PanelTileGrid({ children, sx }) {
return (
{children}
);
}
export { GRID_COLUMNS };