2020-11-05 13:34:48 +01:00
|
|
|
import {UIElement} from "./UIElement";
|
|
|
|
import {DropDown} from "./Input/DropDown";
|
|
|
|
import Locale from "./i18n/Locale";
|
|
|
|
|
|
|
|
export default class LanguagePicker {
|
|
|
|
|
|
|
|
|
|
|
|
public static CreateLanguagePicker(
|
|
|
|
languages : string[] ,
|
|
|
|
label: string | UIElement = "") {
|
|
|
|
|
|
|
|
if (languages.length <= 1) {
|
|
|
|
return undefined;
|
|
|
|
}
|
2021-02-20 03:29:55 +01:00
|
|
|
|
|
|
|
return new DropDown(label, languages.map(lang => {
|
2020-11-05 13:34:48 +01:00
|
|
|
return {value: lang, shown: lang}
|
|
|
|
}
|
2021-06-10 01:36:20 +02:00
|
|
|
), Locale.language, { select_class: 'bg-indigo-100 p-1 rounded hover:bg-indigo-200'});
|
2020-11-05 13:34:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|