import React from "react";
import Lottie from "lottie-react";
import { motion } from "framer-motion";

import animationDeplacement from "../../assets/animations/ecran-deplacement.json";
import { useUser } from "../../hooks/useUser";
import Loading from "../animations/Loading";
export default function MoveAround({ setNextSlide }) {
	const { screensTranslations } = useUser();

	if (!screensTranslations || !screensTranslations.tutorial) return <Loading />;
	const currentScreenTranslations = screensTranslations.tutorial;

	const animationParameters = {
		initial: { x: "100%", opacity: 0 },
		animate: { x: "0%", opacity: 1 },
		exit: { x: "-100%", opacity: 0 },
	};
	return (
		<motion.div
			key='tutorial-move'
			className='modal-content-container tutorial-container'
			initial={animationParameters.initial}
			animate={animationParameters.animate}
			exit={animationParameters.exit}
			transition={{ duration: 0.4, ease: "easeOut" }}>
			<div className='modal-content-container__content'>
				<h3 className='titling-construction '>{currentScreenTranslations.how_to_play}</h3>
				<h2>{currentScreenTranslations.move_around}</h2>

				<p className='explanation'>{currentScreenTranslations.move_around_description}</p>
				<div className='tutorial-container__slides-controls'>
					<button
						className='cta cta--construction cta--round cta--button-icon cta--next'
						onClick={setNextSlide}></button>
				</div>
			</div>
			<div className='modal-content-container__cover'>
				<Lottie
					className='tutorial-container__animated-cover'
					animationData={animationDeplacement}
					loop
					autoplay
				/>
			</div>
		</motion.div>
	);
}
