source: src/components/table/table-selected-action.tsx@ 5d6f37a

main
Last change on this file since 5d6f37a was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago

add customer

  • Property mode set to 100644
File size: 1.5 KB
Line 
1// @mui
2import Checkbox from '@mui/material/Checkbox';
3import Typography from '@mui/material/Typography';
4import Stack, { StackProps } from '@mui/material/Stack';
5
6// ----------------------------------------------------------------------
7
8interface Props extends StackProps {
9 dense?: boolean;
10 action?: React.ReactNode;
11 rowCount: number;
12 numSelected: number;
13 onSelectAllRows: (checked: boolean) => void;
14}
15
16export default function TableSelectedAction({
17 dense,
18 action,
19 rowCount,
20 numSelected,
21 onSelectAllRows,
22 sx,
23 ...other
24}: Props) {
25 if (!numSelected) {
26 return null;
27 }
28
29 return (
30 <Stack
31 direction="row"
32 alignItems="center"
33 sx={{
34 pl: 1,
35 pr: 2,
36 top: 0,
37 left: 0,
38 width: 1,
39 zIndex: 9,
40 height: 58,
41 position: 'absolute',
42 bgcolor: 'primary.lighter',
43 ...(dense && {
44 height: 38,
45 }),
46 ...sx,
47 }}
48 {...other}
49 >
50 <Checkbox
51 indeterminate={!!numSelected && numSelected < rowCount}
52 checked={!!rowCount && numSelected === rowCount}
53 onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
54 onSelectAllRows(event.target.checked)
55 }
56 />
57
58 <Typography
59 variant="subtitle2"
60 sx={{
61 ml: 2,
62 flexGrow: 1,
63 color: 'primary.main',
64 ...(dense && {
65 ml: 3,
66 }),
67 }}
68 >
69 {numSelected} selected
70 </Typography>
71
72 {action && action}
73 </Stack>
74 );
75}
Note: See TracBrowser for help on using the repository browser.