2021-05-11 14:37:15 +00:00
|
|
|
import React, { useContext } from "react"
|
2021-04-29 14:58:31 +00:00
|
|
|
import Select from "../base/Select"
|
|
|
|
import ContextTheme from "../../contexts/ContextTheme"
|
2021-04-21 16:58:14 +00:00
|
|
|
|
|
|
|
|
2021-04-23 00:18:06 +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 SelectTheme({ ...props }) {
|
2021-05-11 14:37:15 +00:00
|
|
|
const { theme, setTheme } = useContext(ContextTheme)
|
2021-04-21 16:58:14 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Select value={theme} onChange={e => setTheme(e.target.value)} {...props}>
|
|
|
|
<option value={"ThemeDark"}>Dark</option>
|
|
|
|
<option value={"ThemeLight"}>Light</option>
|
|
|
|
</Select>
|
|
|
|
)
|
|
|
|
}
|