import React, { useMemo } from "react"; import { Selector, SelectorProps } from "../components"; interface Props { options: readonly Language.Info[]; } type RemovedSelectorProps = Omit< SelectorProps, "label" | "placeholder" >; export type LanguageSelectorProps = Override< Props, RemovedSelectorProps >; function getLabel(lang: Language.Info) { return lang.name; } export function LanguageSelector( props: LanguageSelectorProps ) { const { options, ...selector } = props; const items = useMemo[]>( () => options.map((v) => ({ label: v.name, value: v, })), [options] ); return ( ); }