-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathselect.component.tsx
More file actions
34 lines (30 loc) · 947 Bytes
/
select.component.tsx
File metadata and controls
34 lines (30 loc) · 947 Bytes
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
import React from 'react';
import InputLabel from '@mui/material/InputLabel';
import FormControl from '@mui/material/FormControl';
import Select from '@mui/material/Select';
import { MenuItem } from '@mui/material';
import { languageFormat } from '../trainer.constants';
interface Props {
onChange: (value: string) => void;
value: string;
}
export const SelectComponent: React.FC<Props> = (props) => {
const {onChange,value} = props;
const handleSelectChange = event => {
onChange(event.target.value as string);
};
return (
<FormControl variant="outlined">
<InputLabel htmlFor="outlined-lang-native-simple">Language</InputLabel>
<Select
label="Language"
value={value}
onChange={handleSelectChange}
>
{languageFormat.map(language =>
<MenuItem key={language.id} value={language.id}>{language.label}</MenuItem>
)}
</Select>
</FormControl>
);
};