-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathLanguageSettings.js
More file actions
45 lines (43 loc) · 1.22 KB
/
LanguageSettings.js
File metadata and controls
45 lines (43 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import MenuItem from '@mui/material/MenuItem';
import CheckIcon from '@mui/icons-material/CheckSharp';
import PropTypes from 'prop-types';
/**
* LanguageSettings ~ the workspace sub menu to change the language
* of the application
*/
export function LanguageSettings({ handleClick, languages }) {
return (
<>
{
languages.map(language => (
<MenuItem
aria-selected={language.current}
key={language.locale}
onClick={() => { handleClick(language.locale); }}
>
<ListItemIcon>
{
language.current && <CheckIcon />
}
</ListItemIcon>
<ListItemText primaryTypographyProps={{ variant: 'body1' }}>
{language.label}
</ListItemText>
</MenuItem>
))
}
</>
);
}
LanguageSettings.propTypes = {
handleClick: PropTypes.func.isRequired,
languages: PropTypes.arrayOf(
PropTypes.shape({
current: PropTypes.bool.isRequired,
label: PropTypes.string.isRequired,
locale: PropTypes.string.isRequired,
}),
).isRequired,
};