diff --git a/cspell.json b/cspell.json index a8c5fe4..3255c33 100644 --- a/cspell.json +++ b/cspell.json @@ -2,5 +2,5 @@ "ignorePaths": ["node_modules/**", "*.svg"], "version": "0.2", "language": "en", - "words": ["NATSUMATSURI", "yatai", "Dela", "Yuji", "Syuku", "zustand"] + "words": ["NATSUMATSURI", "yatai", "Dela", "Yuji", "Syuku", "zustand", "wadaiko"] } diff --git a/public/sound/cork_sound.mp3 b/public/sound/cork_sound.mp3 new file mode 100644 index 0000000..91c8d98 Binary files /dev/null and b/public/sound/cork_sound.mp3 differ diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index 46c9c5e..0ca19b9 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -24,7 +24,18 @@ function Home() { }, []); const handleClick = () => { - window.location.href = isPcScreen ? "/yatai" : "/shooter"; + const audio = new Audio("/sound/wadaiko.mp3"); + audio + .play() + .then(() => { + setTimeout(() => { + window.location.href = isPcScreen ? "/yatai" : "/shooter"; + }, 500); + }) + .catch((error) => { + console.error("オーディオの音が出なかった", error); + window.location.href = isPcScreen ? "/yatai" : "/shooter"; + }); }; return ( diff --git a/src/pages/shooter/index.tsx b/src/pages/shooter/index.tsx index 90c1474..2697422 100644 --- a/src/pages/shooter/index.tsx +++ b/src/pages/shooter/index.tsx @@ -16,7 +16,16 @@ function Shooter() { const [images, setImages] = useState(initialImages); const handleClick = () => { - setImages((prevImages) => prevImages.slice(1)); + const audio = new Audio("/sound/cork_sound.mp3"); + audio + .play() + .then(() => { + setImages((prevImages) => prevImages.slice(1)); + }) + .catch((error) => { + console.error("オーディオの音が出なかった", error); + setImages((prevImages) => prevImages.slice(1)); + }); }; const handleKeyUp: KeyboardEventHandler = (event) => {