-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add language selector on login page (#135)
Co-authored-by: Eric Boucher <[email protected]>
- Loading branch information
1 parent
5fd07e8
commit 1e58832
Showing
11 changed files
with
731 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
out/ | ||
public/__ENV.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
module.exports = { | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
root: true, | ||
extends: ['custom/next'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import LanguageIcon from '@mui/icons-material/Language'; | ||
import { | ||
FormControl, | ||
MenuItem, | ||
Select, | ||
SelectChangeEvent, | ||
} from '@mui/material'; | ||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { useLanguageContext } from 'context'; | ||
|
||
const SelectLanguage = (): JSX.Element => { | ||
const { language, setLanguage } = useLanguageContext(); | ||
const handleLanguageChange = (e: SelectChangeEvent) => { | ||
const newLanguage = e.target.value; | ||
setLanguage(newLanguage); | ||
}; | ||
|
||
return ( | ||
<FormControl sx={{ padding: 4 }}> | ||
<Select | ||
value={language} | ||
onChange={handleLanguageChange} | ||
startAdornment={<LanguageIcon sx={{ marginRight: 1 }} />} | ||
> | ||
<MenuItem value="en"> | ||
<FormattedMessage | ||
id="navigation.language.english" | ||
defaultMessage="English" | ||
/> | ||
</MenuItem> | ||
<MenuItem value="km"> | ||
<FormattedMessage | ||
id="navigation.language.khmer" | ||
defaultMessage="ភាសាខ្មែរ" | ||
/> | ||
</MenuItem> | ||
</Select> | ||
</FormControl> | ||
); | ||
}; | ||
|
||
export default SelectLanguage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.