Files
LingvAI/components/LangSelect.tsx
David 5870e4b096 Add manual translate as default (#33)
* Added translate and switch auto buttons

* Tests updated

* Added hotkey & improved buttons visually
2021-07-12 17:06:27 +02:00

28 lines
651 B
TypeScript

import { FC, ChangeEvent } from "react";
import { Select } from "@chakra-ui/react";
type Props = {
value: string,
onChange: (e: ChangeEvent<any>) => void,
langs: [string, string][],
[key: string]: any
};
const LangSelect: FC<Props> = ({ value, onChange, langs, ...props }) => (
<Select
value={value}
onChange={onChange}
variant="flushed"
px={3}
textAlign="center"
style={{ textAlignLast: "center" }}
{...props}
>
{langs.map(([code, name]) => (
<option value={code} key={code}>{name}</option>
))}
</Select>
);
export default LangSelect;