Files
LingvAI/components/LangSelect.tsx

28 lines
651 B
TypeScript
Raw Normal View History

2021-03-16 01:33:19 +01:00
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}
2021-03-16 01:33:19 +01:00
textAlign="center"
2021-03-17 21:30:47 +01:00
style={{ textAlignLast: "center" }}
2021-03-16 01:33:19 +01:00
{...props}
>
{langs.map(([code, name]) => (
<option value={code} key={code}>{name}</option>
))}
</Select>
);
export default LangSelect;