From 6e9b7e6fd80018a778255194b520b90298c3d5dd Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Sat, 8 Aug 2020 23:50:44 -0400 Subject: [PATCH] Header: implement new snazzy Header The new Header component uses framer-motion to animate transitions between illustrations and x-ray views showing the icons used in their construction. --- src/components/Header/Header.css | 48 ++++++ src/components/Header/Header.tsx | 244 ++++++++++++++++++++++++++++--- 2 files changed, 275 insertions(+), 17 deletions(-) diff --git a/src/components/Header/Header.css b/src/components/Header/Header.css index fa24a73..b4642fe 100644 --- a/src/components/Header/Header.css +++ b/src/components/Header/Header.css @@ -10,6 +10,50 @@ header { justify-content: center; */ } +.intro { + width: 660px; + position: absolute; + transform: translate(143px, 392px); +} + +.intro h2 { + font-size: 40px; + line-height: 50px; + margin-bottom: 32px; +} + +div.links { + display: flex; + align-items: center; + justify-content: flex-start; + margin: 56px 0 0; +} + +.links a:not(:first-child) { + margin-left: 48px; +} + +a.nav-link { + text-decoration: none; + position: relative; + color: black; +} + +a.nav-link:after { + content: ''; + position: absolute; + bottom: -2px; + left: 0; + width: 0%; + border-bottom: 1px solid black; + transition: 0.2s; +} + +a.nav-link:hover:after { + width: 100%; +} + + .image-container { position: relative; width: 1366px; @@ -17,6 +61,10 @@ header { margin: auto; } +.inspectable { + cursor: cell; +} + #marker-purple { position: absolute; transform: translate(143px, -158px); diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 72d0be4..e7e5bcd 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -1,43 +1,253 @@ -import React from "react"; -import { motion } from "framer-motion"; +import React, { useState } from "react"; +import { motion, AnimatePresence } from "framer-motion"; import markerPurple from "../../assets/marker-purple.svg"; -import tablet from "../../assets/tablet.svg"; -import billiardBall from "../../assets/billiard-ball.svg"; -import warning from "../../assets/warning.svg"; import paperclips from "../../assets/paperclips.svg"; +import tablet from "../../assets/tablet.svg"; +import tabletSpec from "../../assets/tablet-spec.svg"; +import billiardBall from "../../assets/billiard-ball.svg"; +import billiardBallSpec from "../../assets/billiard-ball-spec.svg"; +import warning from "../../assets/warning.svg"; +import warningSpec from "../../assets/warning-spec.svg"; import cuttingMat from "../../assets/cutting-mat.svg"; +import cuttingMatSpec from "../../assets/cutting-mat-spec.svg"; import receipt from "../../assets/receipt.svg"; +import receiptSpec from "../../assets/receipt-spec.svg"; import calculator from "../../assets/calculator.svg"; +import calculatorSpec from "../../assets/calculator-spec.svg"; import "./Header.css"; type HeaderProps = {}; const variants = { - hidden: { opacity: 0, y: 100 }, - visible: { opacity: 1, y: 0 }, + hidden: { opacity: 0, transition: { duration: 0.2 } }, + visible: { opacity: 1, transition: { duration: 0.2 } }, }; const Header: React.FC = () => { + const [hovered, setHovered] = useState(false); + const clearHover = () => setHovered(false); + // const handleScrollToIcons = () => {}; + return (
- {/* */} - {/* */} - - - - - - + + {hovered === "tablet" ? ( + setHovered("tablet")} + onHoverEnd={clearHover} + src={tabletSpec} + /> + ) : ( + setHovered("tablet")} + // onHoverEnd={clearHover} + src={tablet} + /> + )} + {hovered === "billiard-ball" ? ( + setHovered("billiard-ball")} + onHoverEnd={clearHover} + src={billiardBallSpec} + /> + ) : ( + setHovered("billiard-ball")} + // onHoverEnd={clearHover} + src={billiardBall} + /> + )} + {hovered === "warning" ? ( + setHovered("warning")} + onHoverEnd={clearHover} + src={warningSpec} + /> + ) : ( + setHovered("warning")} + // onHoverEnd={clearHover} + src={warning} + /> + )} + {hovered === "cutting-mat" ? ( + setHovered("cutting-mat")} + onHoverEnd={clearHover} + src={cuttingMatSpec} + /> + ) : ( + setHovered("cutting-mat")} + // onHoverEnd={clearHover} + src={cuttingMat} + /> + )} + {hovered === "receipt" ? ( + setHovered("receipt")} + onHoverEnd={clearHover} + src={receiptSpec} + /> + ) : ( + setHovered("receipt")} + // onHoverEnd={clearHover} + src={receipt} + /> + )} + {hovered === "calculator" ? ( + setHovered("calculator")} + onHoverEnd={clearHover} + src={calculatorSpec} + /> + ) : ( + setHovered("calculator")} + // onHoverEnd={clearHover} + src={calculator} + /> + )} + +
+

+ Phosphor Icons is a flexible icon family for interfaces, diagrams, + presentations – whatever really. +

+
+ + + +
+ +
);