Newer
Older
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
35
36
37
38
39
40
41
42
import ComboBox from "../ui/ComboBox";
import { connectState } from "../../redux/connector";
import { WithDispatcher } from "../../redux/reducers";
import { LanguageEntry, Languages } from "../../context/Locale";
type Props = WithDispatcher & {
locale: string;
};
export function LocaleSelector(props: Props) {
return (
<ComboBox
value={props.locale}
onChange={e =>
props.dispatcher &&
props.dispatcher({
type: "SET_LOCALE",
locale: e.currentTarget.value as any
})
}
>
{Object.keys(Languages).map(x => {
const l = (Languages as any)[x] as LanguageEntry;
return (
<option value={x}>
{l.emoji} {l.display}
</option>
);
})}
</ComboBox>
);
}
export default connectState(
LocaleSelector,
state => {
return {
locale: state.locale
};
},
true
);