Skip to content

Commit

Permalink
add: prop to sound interval
Browse files Browse the repository at this point in the history
  • Loading branch information
myroslav111 committed Nov 23, 2022
1 parent 6ed1a75 commit 9e7aec2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function Card() {
onWord={word}
onIndexWord={indexWord}
currentLanguage={currentLanguage}
stateForSwitchWord={stateForSwitchWord}
/>

{word.length > 0 && (
Expand Down
12 changes: 7 additions & 5 deletions src/components/SoundInterval/SoundInterval.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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') {
Expand Down

0 comments on commit 9e7aec2

Please sign in to comment.