excalidraw/src/components/LanguageList.tsx
Jed Fox 663526129a
Proper RTL support (#1154)
* Add RTL styles. Most of the work is done by the browser 💖

* Refactor getLanguage

* Additional fixes

* Mirror the mouse pointer icon

* Move the vertical scrollbar to the left on RTL

* Revert "Mirror the mouse pointer icon"

This reverts commit f69b132538038d231b1b1acc0d6f4a28c91130bb.
2020-04-02 12:21:19 -04:00

34 lines
868 B
TypeScript

import React from "react";
import * as i18n from "../i18n";
export function LanguageList({
onChange,
languages = i18n.languages,
currentLanguage = i18n.getLanguage().lng,
floating,
}: {
languages?: { lng: string; label: string }[];
onChange: (value: string) => void;
currentLanguage?: string;
floating?: boolean;
}) {
return (
<React.Fragment>
<select
className={`dropdown-select dropdown-select__language${
floating ? " dropdown-select--floating" : ""
}`}
onChange={({ target }) => onChange(target.value)}
value={currentLanguage}
aria-label={i18n.t("buttons.selectLanguage")}
>
{languages.map((language) => (
<option key={language.lng} value={language.lng}>
{language.label}
</option>
))}
</select>
</React.Fragment>
);
}