1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-23 13:34:19 +00:00
pds-2021-g2-nest/nest_frontend/components/interactive/SelectLanguage.js

25 lines
848 B
JavaScript
Raw Normal View History

2021-05-18 00:04:06 +00:00
import React, { useContext } from "react"
2021-05-17 14:32:42 +00:00
import Select from "../base/Select"
2021-05-18 00:04:06 +00:00
import ContextLanguage from "../../contexts/ContextLanguage"
2021-05-17 14:32:42 +00:00
/**
* A {@link Select} which allows the user to choose between the various available themes, switching between them as soon
* as the user selects a different one.
*
* @param props - Additional props to pass to the {@link Select}.
* @returns {JSX.Element}
* @constructor
*/
export default function SelectLanguage({ ...props }) {
2021-05-18 00:48:34 +00:00
const { strings, lang, setLang } = useContext(ContextLanguage)
2021-05-17 14:32:42 +00:00
return (
2021-05-18 00:04:06 +00:00
<Select value={lang} onChange={event => setLang(event.target.value)} {...props}>
2021-05-17 14:32:42 +00:00
<option value={"it"}>🇮🇹 Italiano</option>
<option value={"en"}>🇬🇧 English</option>
<option value={"fi"}>🇫🇮 Suomi</option>
</Select>
)
}