|
1 | 1 | import React from 'react';
|
2 | 2 | import clsx from 'clsx';
|
3 |
| -import { createStyles, WithStyles, withStyles } from '@mui/styles'; |
4 |
| -import { Accordion, AccordionDetails, AccordionSummary, CustomTheme } from '@mui/material'; |
| 3 | +import { Box, Accordion, AccordionDetails, AccordionSummary, Typography } from '@mui/material'; |
5 | 4 | import { ExpandMore } from '@mui/icons-material';
|
6 |
| -import Typography from '@mui/material/Typography'; |
7 | 5 | import ManageUsersView from './ManageUsersView';
|
8 | 6 |
|
9 |
| -const styles = (theme: CustomTheme) => |
10 |
| - createStyles({ |
11 |
| - header: { |
12 |
| - fontSize: '14px', |
13 |
| - lineHeight: '22px', |
14 |
| - fontWeight: '600', |
15 |
| - color: theme.palette.primary.main, |
16 |
| - }, |
17 |
| - expandIcon: { |
18 |
| - color: theme.palette.primary.main, |
19 |
| - }, |
20 |
| - canManageUsers: { |
21 |
| - paddingTop: 0, |
22 |
| - }, |
23 |
| - noUsers: { |
24 |
| - fontStyle: 'italic', |
25 |
| - colorPrimary: theme.palette.error.contrastText, |
26 |
| - color: theme.palette.error.contrastText, |
27 |
| - paddingBottom: theme.spacing(1), |
28 |
| - }, |
29 |
| - }); |
30 |
| - |
31 |
| -interface UserListProps extends WithStyles<typeof styles> { |
| 7 | +interface UserListProps { |
32 | 8 | canManageUsers: boolean;
|
33 | 9 | defaultOpen?: boolean;
|
34 | 10 | removeUser?: (removableEmail: string) => void;
|
35 | 11 | typeOfUsers: string;
|
36 | 12 | users: Array<string>;
|
37 | 13 | }
|
38 | 14 |
|
39 |
| -function UserList({ |
40 |
| - classes, |
41 |
| - canManageUsers, |
42 |
| - defaultOpen, |
43 |
| - removeUser, |
44 |
| - typeOfUsers, |
45 |
| - users, |
46 |
| -}: UserListProps) { |
| 15 | +function UserList({ canManageUsers, defaultOpen, removeUser, typeOfUsers, users }: UserListProps) { |
47 | 16 | return (
|
48 | 17 | <Accordion defaultExpanded={defaultOpen}>
|
49 | 18 | <AccordionSummary
|
50 |
| - expandIcon={<ExpandMore className={classes.expandIcon} />} |
51 |
| - className={classes.header} |
| 19 | + expandIcon={<ExpandMore sx={{ color: 'primary.main' }} />} |
| 20 | + sx={{ |
| 21 | + fontSize: '14px', |
| 22 | + lineHeight: '22px', |
| 23 | + fontWeight: '600', |
| 24 | + color: 'primary.main', |
| 25 | + }} |
52 | 26 | data-cy={`user-list-${typeOfUsers}`}
|
53 | 27 | >
|
54 | 28 | {typeOfUsers}
|
55 | 29 | </AccordionSummary>
|
56 | 30 | <AccordionDetails
|
57 | 31 | data-cy="user-email"
|
58 |
| - className={clsx({ |
59 |
| - [classes.canManageUsers]: canManageUsers, |
60 |
| - })} |
| 32 | + sx={{ |
| 33 | + paddingTop: canManageUsers ? 0 : undefined, |
| 34 | + }} |
61 | 35 | >
|
62 | 36 | <ManageUsersView removeUser={canManageUsers ? removeUser : undefined} users={users} />
|
63 |
| - {users.length === 0 && <Typography className={classes.noUsers}>(None)</Typography>} |
| 37 | + {users.length === 0 && ( |
| 38 | + <Typography |
| 39 | + sx={{ |
| 40 | + fontStyle: 'italic', |
| 41 | + color: 'error.contrastText', |
| 42 | + paddingBottom: '8px', |
| 43 | + }} |
| 44 | + > |
| 45 | + (None) |
| 46 | + </Typography> |
| 47 | + )} |
64 | 48 | </AccordionDetails>
|
65 | 49 | </Accordion>
|
66 | 50 | );
|
67 | 51 | }
|
68 | 52 |
|
69 |
| -export default withStyles(styles)(UserList); |
| 53 | +export default UserList; |
0 commit comments