setLoading wern't suppose to be false...

This commit is contained in:
Late's Macbook 2025-06-28 21:37:36 +07:00
parent c22e940303
commit 3a3abdebfb
2 changed files with 4 additions and 4 deletions

View file

@ -1,11 +1,11 @@
import '../../css/video.css'; import '../../css/video.css';
function Image({ src = "hallway_MMM.mp4" ,side = "middle", alt = "this is a video" }) { function Image({ src = "bg-hallway.png", side = "middle", alt = "this is an image", onImageLoad }) {
const urlSource = `${import.meta.env.VITE_ASSETS_URL}/${src}`; const urlSource = `${import.meta.env.VITE_ASSETS_URL}/${src}`;
return ( return (
<div className={`image-container ${side}`}> <div className={`image-container ${side}`}>
<img src={urlSource} alt={alt}/> <img src={urlSource} alt={alt} onLoad={onImageLoad} />
</div> </div>
); );
} }

View file

@ -10,7 +10,7 @@ import Character from './class/character.jsx';
function IntroductionPage() { function IntroductionPage() {
const navigate = useNavigate(); const navigate = useNavigate();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(true);
const [isClickedIntroduction, setIsClickedIntroduction] = useState(false); const [isClickedIntroduction, setIsClickedIntroduction] = useState(false);
const [numChar, setNumChar] = useState(1); const [numChar, setNumChar] = useState(1);
const character = new Character(); const character = new Character();
@ -42,7 +42,7 @@ function IntroductionPage() {
<LoadImage <LoadImage
src='bg-hallway.png' src='bg-hallway.png'
side={character.position(numChar)} side={character.position(numChar)}
onVideoReady={handleVideoReady} onImageLoad={handleVideoReady}
/> />
) : ( ) : (
<PlayVideo <PlayVideo