From daee64ac0580b3571cc427a094633c300f024a48 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 28 Sep 2021 19:49:08 +0200 Subject: intro image --- src/views/Intro.js | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'src/views/Intro.js') diff --git a/src/views/Intro.js b/src/views/Intro.js index 9c00ce4..d87213e 100644 --- a/src/views/Intro.js +++ b/src/views/Intro.js @@ -2,34 +2,57 @@ * Intro */ -import React, { useState } from "react"; +import React, { useState, useCallback } from "react"; import Vimeo from "@u-wave/react-vimeo"; export default function Intro({ onComplete }) { const [done, setDone] = useState(false); - const handleClose = () => { + const [playing, setPlaying] = useState(false); + const [player, setPlayer] = useState(false); + const [videoSize] = useState(coverWindow()); + + const handleClose = useCallback(() => { setDone(true); setTimeout(() => { onComplete(); }, 200); - }; + }, []); + return (
- +
{ + setPlaying(true); + player.play(); + }} + /> +
); } + +const coverWindow = () => { + const videoRatio = 1.777; + const screenRatio = window.innerWidth / window.innerHeight; + if (screenRatio > videoRatio) { + return { width: "100vw", height: 100 * 1.777 + "vh" }; + } else { + return { width: "177vh", height: "100vh" }; + } +}; -- cgit v1.2.3-70-g09d2