diff --git a/src/components/Card/Card.jsx b/src/components/Card/Card.jsx index 379b598..9173526 100644 --- a/src/components/Card/Card.jsx +++ b/src/components/Card/Card.jsx @@ -126,6 +126,7 @@ function Card() { onWord={word} onIndexWord={indexWord} currentLanguage={currentLanguage} + stateForSwitchWord={stateForSwitchWord} /> {word.length > 0 && ( diff --git a/src/components/SoundInterval/SoundInterval.jsx b/src/components/SoundInterval/SoundInterval.jsx index 5aef69a..966db8d 100644 --- a/src/components/SoundInterval/SoundInterval.jsx +++ b/src/components/SoundInterval/SoundInterval.jsx @@ -5,7 +5,12 @@ import { useState, useEffect } from 'react'; let myCounter = 0; let timeout = null; -const SoundInterval = ({ onWord, onIndexWord, currentLanguage }) => { +const SoundInterval = ({ + onWord, + onIndexWord, + currentLanguage, + stateForSwitchWord, +}) => { const [counter, setCounter] = useState(0); const [togle, setTogle] = useState(false); console.log(onWord.length); @@ -28,15 +33,12 @@ const SoundInterval = ({ onWord, onIndexWord, currentLanguage }) => { }; // логіка кнопки озвучування const handleClickSound = c => { - // setTogle(prev => !prev); - // console.log(c); - // e.preventDefault(); let soundWordIndex = onWord.filter((el, idx) => idx === c); const synth = window.speechSynthesis; // зупинемо все, що вже синтезується раніше synth.cancel(); - console.log('hallo', soundWordIndex); + // читання тексту const utterance = new SpeechSynthesisUtterance(soundWordIndex[0].en); if (currentLanguage === 'en') {