Footer: fix phoneSpec overlap problem

This commit is contained in:
rektdeckard
2020-08-21 14:56:49 -04:00
parent 6b7a594191
commit 510dcc1ebb

View File

@@ -1,4 +1,4 @@
import React from "react"; import React, { useState } from "react";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import { Heart } from "phosphor-react"; import { Heart } from "phosphor-react";
@@ -18,6 +18,8 @@ const variants = {
}; };
const Footer: React.FC<FooterProps> = () => { const Footer: React.FC<FooterProps> = () => {
const [phoneHovered, setPhoneHovered] = useState<boolean>(false);
return ( return (
<footer> <footer>
<div className="container"> <div className="container">
@@ -89,13 +91,25 @@ const Footer: React.FC<FooterProps> = () => {
<img src={uArrowUpLeft} alt="" /> <img src={uArrowUpLeft} alt="" />
</button> </button>
</div> </div>
<img id="phone" className="inspectable" src={phoneSpec} alt="" /> {phoneHovered && (
<motion.img
id="phone"
className="inspectable"
variants={variants}
initial="hidden"
animate={phoneHovered ? "visible" : "hidden"}
src={phoneSpec}
alt=""
/>
)}
<motion.img <motion.img
id="phone" id="phone"
className="inspectable" className="inspectable"
variants={variants} variants={variants}
initial="visible" initial="visible"
whileHover="hidden" whileHover="hidden"
onHoverStart={() => setPhoneHovered(true)}
onHoverEnd={() => setPhoneHovered(false)}
src={phone} src={phone}
alt="" alt=""
/> />