import LightButton from "@/components/buttons/LightButton"; import ACard from "@/components/cards/ACard"; import BCard from "@/components/cards/BCard"; import { LOCALES } from "@/config/locales"; import { Dispatch, SetStateAction, useState } from "react"; import { WordData } from "@/interfaces"; import NavbarCenterWrapper from "@/components/NavbarCenterWrapper"; interface Props { setEditPage: Dispatch>; wordData: WordData; setWordData: Dispatch>; localeKey: 0 | 1; } export default function Choose({ setEditPage, wordData, setWordData, localeKey, }: Props) { const [chosenLocale, setChosenLocale] = useState< (typeof LOCALES)[number] | null >(null); const handleChooseClick = () => { if (chosenLocale) { setWordData({ locales: [ localeKey === 0 ? chosenLocale : wordData.locales[0], localeKey === 1 ? chosenLocale : wordData.locales[1], ], wordPairs: wordData.wordPairs, }); setEditPage("edit"); } }; return (
{LOCALES.map((locale, index) => ( setChosenLocale(locale)} > {locale} ))}
Choose setEditPage("edit")}>Back
); }