lion/packages/helpers/sb-locale-switcher/src/SbLocaleSwitcher.js
Joren Broekema 874ff48339 feat(form-core): form-core types
Co-authored-by: Thijs Louisse <Thijs.Louisse@ing.com>
2020-09-02 09:02:47 +02:00

29 lines
648 B
JavaScript

import { LitElement, html } from '@lion/core';
export class SbLocaleSwitcher extends LitElement {
static get properties() {
return {
showLocales: { type: Array, attribute: 'show-locales' },
};
}
constructor() {
super();
this.showLocales = ['en-GB', 'en-US', 'en-AU', 'nl-NL', 'nl-BE'];
}
// eslint-disable-next-line class-methods-use-this
callback(locale) {
document.documentElement.lang = locale;
}
render() {
return html`
${this.showLocales.map(
showLocale => html`
<button @click=${() => this.callback(showLocale)}>${showLocale}</button>
`,
)}
`;
}
}