fix: dict audio

This commit is contained in:
Gabe Yuan
2024-03-25 21:00:39 +08:00
parent a83039577c
commit 602b51b1f5
3 changed files with 21 additions and 17 deletions

View File

@@ -3,13 +3,9 @@ import VolumeUpIcon from "@mui/icons-material/VolumeUp";
import { useTextAudio } from "../../hooks/Audio";
export default function AudioBtn({ text, lan = "uk" }) {
const { error, ready, playing, play } = useTextAudio(text, lan);
const { error, ready, playing, onPlay } = useTextAudio(text, lan);
if (error) {
return;
}
if (!ready) {
if (error || !ready) {
return (
<IconButton disabled>
<VolumeUpIcon />
@@ -26,11 +22,7 @@ export default function AudioBtn({ text, lan = "uk" }) {
}
return (
<IconButton
onClick={() => {
play();
}}
>
<IconButton onClick={onPlay}>
<VolumeUpIcon />
</IconButton>
);