import React from 'react';
import {
makeStyles,
createStyles,
Grid,
Typography,
Button,
} from '@material-ui/core';
import { PopupFooterProps } from './props';
import { FOOTER_HEIGHT } from './constants/layout';
const useStyles = makeStyles(theme =>
createStyles({
root: {
width: '100%',
height: FOOTER_HEIGHT,
margin: 0,
'& > div': { padding: theme.spacing(0, 1) + ' !important' },
},
count: {
display: 'block',
marginLeft: theme.spacing(1),
fontFeatureSettings: '"tnum"',
color: theme.palette.text.disabled,
userSelect: 'none',
},
button: { display: 'flex' },
})
);
export default function PopupFooter({
multiple,
selectAll,
clearable,
onSelectAll,
onClear,
onClose,
countText,
value,
options,
max,
}: PopupFooterProps) {
const classes = useStyles();
const clearButton = (
);
if (multiple)
return (
{countText ??
`${value.length} of ${options.length}${
max ? ', max ' + max : ''
}`}
{selectAll ? (
{value.length > 0 && clearable !== false ? (
clearButton
) : (
)}
) : (
clearable !== false && (
{clearButton}
)
)}
);
if (clearable)
return (
{clearButton}
);
return null;
}