2022-08-31 15:57:31 +00:00
|
|
|
import React from 'react';
|
2022-09-13 07:36:00 +00:00
|
|
|
import { makeStyles } from 'tss-react/mui';
|
2022-08-31 15:57:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
import LanguageListItem from './LanguageListItem';
|
|
|
|
|
|
|
|
interface ILanguageListProps {
|
2022-10-20 09:11:27 +00:00
|
|
|
items: Array<ILanguageItem>;
|
2022-08-31 15:57:31 +00:00
|
|
|
onLanguageSelected: (lang: string) => void;
|
2022-09-08 09:52:36 +00:00
|
|
|
selectedLanguage: string;
|
2022-08-31 15:57:31 +00:00
|
|
|
}
|
|
|
|
|
2022-09-13 07:36:00 +00:00
|
|
|
const useStyles = makeStyles()(() => {
|
2022-08-31 15:57:31 +00:00
|
|
|
return {
|
|
|
|
itemsContainer: {
|
|
|
|
display: 'flex',
|
|
|
|
flexFlow: 'column'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2022-10-20 09:11:27 +00:00
|
|
|
interface ILanguageItem {
|
2022-09-08 09:52:36 +00:00
|
|
|
id: string;
|
|
|
|
lang: string;
|
|
|
|
selected: boolean;
|
2022-08-31 15:57:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Component that renders the security options dialog.
|
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
|
|
|
const LanguageList = ({
|
|
|
|
items,
|
|
|
|
onLanguageSelected
|
|
|
|
}: ILanguageListProps) => {
|
2022-09-13 07:36:00 +00:00
|
|
|
const { classes: styles } = useStyles();
|
2022-08-31 15:57:31 +00:00
|
|
|
const listItems = items.map(item => (<LanguageListItem
|
|
|
|
key = { item.id }
|
|
|
|
lang = { item.lang }
|
|
|
|
onLanguageSelected = { onLanguageSelected }
|
|
|
|
selected = { item.selected } />));
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className = { styles.itemsContainer }>{listItems}</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default LanguageList;
|