diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-09-02 20:33:23 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-09-02 20:33:23 -0700 |
commit | e07d5ff079527da0c07c4f8ede0aaef272517393 (patch) | |
tree | 1941791e4b8ab4b98c3eeefb5e0d00b34ff1bec0 /modern/src/components/registration | |
parent | 2b34c3d6c00c29b1590403e5d62e18b91145abcc (diff) | |
parent | 363198118bba28ad3a37e200a7db2ca02bf2eae7 (diff) | |
download | etbsa-traccar-web-e07d5ff079527da0c07c4f8ede0aaef272517393.tar.gz etbsa-traccar-web-e07d5ff079527da0c07c4f8ede0aaef272517393.tar.bz2 etbsa-traccar-web-e07d5ff079527da0c07c4f8ede0aaef272517393.zip |
Merge into oyhan-master
Diffstat (limited to 'modern/src/components/registration')
-rw-r--r-- | modern/src/components/registration/LoginForm.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/modern/src/components/registration/LoginForm.js b/modern/src/components/registration/LoginForm.js index e6da05e..9b5ca3e 100644 --- a/modern/src/components/registration/LoginForm.js +++ b/modern/src/components/registration/LoginForm.js @@ -6,7 +6,7 @@ import { useTheme } from '@material-ui/core/styles'; import { useDispatch, useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; import { sessionActions } from '../../store'; -import t from '../../common/localization'; +import t, { useLocalization } from '../../common/localization'; import StartPage from '../../StartPage'; const useStyles = makeStyles((theme) => ({ @@ -24,6 +24,7 @@ const LoginForm = () => { const dispatch = useDispatch(); const history = useHistory(); const theme = useTheme(); + const { language, languageList, setLanguage } = useLocalization(); const [failed, setFailed] = useState(false); const [email, setEmail] = useState(''); @@ -61,16 +62,20 @@ const LoginForm = () => { } }; + const handleLanguageChange = (e) => { + setLanguage(e.target.value); + }; + return ( <StartPage> <Grid container direction="column" spacing={2}> {useMediaQuery(theme.breakpoints.down('md')) && ( - <Grid item className={classes.logoContainer}> - <svg height="64" width="240"> - <use xlinkHref="/logo.svg#img" /> - </svg> - </Grid> + <Grid item className={classes.logoContainer}> + <svg height="64" width="240"> + <use xlinkHref="/logo.svg#img" /> + </svg> + </Grid> )} <Grid item> <TextField @@ -124,8 +129,8 @@ const LoginForm = () => { <Grid item xs> <FormControl variant="filled" fullWidth> <InputLabel>{t('loginLanguage')}</InputLabel> - <Select> - <MenuItem value="en">English</MenuItem> + <Select value={language} onChange={handleLanguageChange}> + {languageList.map((lang) => <MenuItem key={lang.code} value={lang.code}>{lang.name}</MenuItem>)} </Select> </FormControl> </Grid> |