Skip to content

Commit 5ac0898

Browse files
committed
UserList - update by copilot
1 parent 4539f5d commit 5ac0898

File tree

1 file changed

+25
-41
lines changed

1 file changed

+25
-41
lines changed

src/components/UserList.tsx

+25-41
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,53 @@
11
import React from 'react';
22
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';
54
import { ExpandMore } from '@mui/icons-material';
6-
import Typography from '@mui/material/Typography';
75
import ManageUsersView from './ManageUsersView';
86

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 {
328
canManageUsers: boolean;
339
defaultOpen?: boolean;
3410
removeUser?: (removableEmail: string) => void;
3511
typeOfUsers: string;
3612
users: Array<string>;
3713
}
3814

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) {
4716
return (
4817
<Accordion defaultExpanded={defaultOpen}>
4918
<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+
}}
5226
data-cy={`user-list-${typeOfUsers}`}
5327
>
5428
{typeOfUsers}
5529
</AccordionSummary>
5630
<AccordionDetails
5731
data-cy="user-email"
58-
className={clsx({
59-
[classes.canManageUsers]: canManageUsers,
60-
})}
32+
sx={{
33+
paddingTop: canManageUsers ? 0 : undefined,
34+
}}
6135
>
6236
<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+
)}
6448
</AccordionDetails>
6549
</Accordion>
6650
);
6751
}
6852

69-
export default withStyles(styles)(UserList);
53+
export default UserList;

0 commit comments

Comments
 (0)