excalidraw/src/components/LanguageList.tsx

28 lines
606 B
TypeScript
Raw Normal View History

import React from "react";
export function LanguageList<T>({
onClick,
languages,
2020-01-24 12:04:54 +02:00
currentLanguage,
}: {
languages: { lng: string; label: string }[];
onClick: (value: string) => void;
currentLanguage: string;
}) {
return (
<React.Fragment>
<select
className="language-select"
onChange={({ target }) => onClick(target.value)}
value={currentLanguage}
>
{languages.map(language => (
<option key={language.lng} value={language.lng}>
{language.label}
</option>
))}
</select>
</React.Fragment>
);
}