Files
LingvAI/components/LangSelect.tsx
2021-03-16 01:33:19 +01:00

27 lines
607 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={2}
textAlign="center"
{...props}
>
{langs.map(([code, name]) => (
<option value={code} key={code}>{name}</option>
))}
</Select>
);
export default LangSelect;