import ToolContent from '@components/ToolContent'; import React, { useState } from 'react'; import ToolTextInput from '@components/input/ToolTextInput'; import ToolTextResult from '@components/result/ToolTextResult'; import { compute } from './service'; import TextFieldWithDesc from '@components/options/TextFieldWithDesc'; import { useTranslation } from 'react-i18next'; const initialValues = { dotSymbol: '.', dashSymbol: '-' }; export default function ToMorse() { const { t } = useTranslation(); const [input, setInput] = useState(''); const [result, setResult] = useState(''); const computeOptions = (optionsValues: typeof initialValues, input: any) => { const { dotSymbol, dashSymbol } = optionsValues; setResult(compute(input, dotSymbol, dashSymbol)); }; return ( } resultComponent={ } getGroups={({ values, updateField }) => [ { title: t('string.toMorse.shortSignal'), component: ( updateField('dotSymbol', val)} /> ) }, { title: t('string.toMorse.longSignal'), component: ( updateField('dashSymbol', val)} /> ) } ]} /> ); }