From 23b14e083ee3f7a4ad0816d9860283eec76cca34 Mon Sep 17 00:00:00 2001 From: Lynn Fisher Date: Tue, 4 Jun 2024 09:42:25 -0700 Subject: [PATCH] remove Query.gg banner --- .../img/querygg/corner-fish-bottom-right.svg | 1 - .../public/img/querygg/corner-top-left.svg | 1 - .../public/img/querygg/corner-top-right.svg | 1 - .../public/img/querygg/header-course.svg | 1 - .../src/components/CountdownTimer.tsx | 89 ------------------- .../src/components/QueryGGBanner.astro | 61 ------------- usehooks.com/src/pages/index.astro | 2 - 7 files changed, 156 deletions(-) delete mode 100644 usehooks.com/public/img/querygg/corner-fish-bottom-right.svg delete mode 100644 usehooks.com/public/img/querygg/corner-top-left.svg delete mode 100644 usehooks.com/public/img/querygg/corner-top-right.svg delete mode 100644 usehooks.com/public/img/querygg/header-course.svg delete mode 100644 usehooks.com/src/components/CountdownTimer.tsx delete mode 100644 usehooks.com/src/components/QueryGGBanner.astro diff --git a/usehooks.com/public/img/querygg/corner-fish-bottom-right.svg b/usehooks.com/public/img/querygg/corner-fish-bottom-right.svg deleted file mode 100644 index 21ca01c..0000000 --- a/usehooks.com/public/img/querygg/corner-fish-bottom-right.svg +++ /dev/null @@ -1 +0,0 @@ -three-eyed fish \ No newline at end of file diff --git a/usehooks.com/public/img/querygg/corner-top-left.svg b/usehooks.com/public/img/querygg/corner-top-left.svg deleted file mode 100644 index 5db5839..0000000 --- a/usehooks.com/public/img/querygg/corner-top-left.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/usehooks.com/public/img/querygg/corner-top-right.svg b/usehooks.com/public/img/querygg/corner-top-right.svg deleted file mode 100644 index 987be57..0000000 --- a/usehooks.com/public/img/querygg/corner-top-right.svg +++ /dev/null @@ -1 +0,0 @@ -moon with a face \ No newline at end of file diff --git a/usehooks.com/public/img/querygg/header-course.svg b/usehooks.com/public/img/querygg/header-course.svg deleted file mode 100644 index 959fedb..0000000 --- a/usehooks.com/public/img/querygg/header-course.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/usehooks.com/src/components/CountdownTimer.tsx b/usehooks.com/src/components/CountdownTimer.tsx deleted file mode 100644 index 2d612d9..0000000 --- a/usehooks.com/src/components/CountdownTimer.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { Fragment, useEffect, useState } from "react"; - -interface CountdownProps { - targetDate: string; // YYYY-MM-DD format -} - -interface TimeLeft { - days: number; - hours: number; - minutes: number; - seconds: number; -} - -function calculateTimeLeft(targetDate: string): TimeLeft { - const target = new Date(`${targetDate}T00:00:00-08:00`); - const now = new Date(); - const difference = +target - +now; - - if (difference <= 0) { - return { - days: 0, - hours: 0, - minutes: 0, - seconds: 0, - }; - } - - return { - days: Math.floor(difference / (1000 * 60 * 60 * 24)), - hours: Math.floor((difference / (1000 * 60 * 60)) % 24), - minutes: Math.floor((difference / 1000 / 60) % 60), - seconds: Math.floor((difference / 1000) % 60), - }; -} - -const formatNumber = (number: number) => number.toString().padStart(2, "0"); - -const Countdown: React.FC = ({ targetDate }) => { - const [timeLeft, setTimeLeft] = useState( - calculateTimeLeft(targetDate) - ); - - useEffect(() => { - const timer = setInterval(() => { - const newTimeLeft = calculateTimeLeft(targetDate); - setTimeLeft(newTimeLeft); - if ( - newTimeLeft.days === 0 && - newTimeLeft.hours === 0 && - newTimeLeft.minutes === 0 && - newTimeLeft.seconds === 0 - ) { - clearInterval(timer); - } - }, 1000); - - return () => clearInterval(timer); - }, [targetDate]); - - if ( - timeLeft.days === 0 && - timeLeft.hours === 0 && - timeLeft.minutes === 0 && - timeLeft.seconds === 0 - ) { - return null; - } - - return ( -
- {["days", "hours", "minutes", "seconds"].map((unit, index) => ( - - {index > 0 && :} -
- - {formatNumber(timeLeft[unit as keyof TimeLeft]).charAt(0)} - - - {formatNumber(timeLeft[unit as keyof TimeLeft]).charAt(1)} - -

{unit}

-
-
- ))} -
- ); -}; - -export default Countdown; diff --git a/usehooks.com/src/components/QueryGGBanner.astro b/usehooks.com/src/components/QueryGGBanner.astro deleted file mode 100644 index 2965b98..0000000 --- a/usehooks.com/src/components/QueryGGBanner.astro +++ /dev/null @@ -1,61 +0,0 @@ ---- -import Button from "./Button.astro"; -import CountdownTimer from "./CountdownTimer"; ---- - - - - diff --git a/usehooks.com/src/pages/index.astro b/usehooks.com/src/pages/index.astro index 79a0229..d9846b7 100644 --- a/usehooks.com/src/pages/index.astro +++ b/usehooks.com/src/pages/index.astro @@ -5,7 +5,6 @@ import NavMain from "../sections/NavMain.astro"; import HomeHero from "../sections/HomeHero.astro"; import HooksList from "../components/search/HooksList"; import Footer from "../sections/Footer.astro"; -import QueryGGBanner from "../components/QueryGGBanner.astro"; const hooks = await getCollection("hooks"); --- @@ -14,7 +13,6 @@ const hooks = await getCollection("hooks"); title="useHooks – The React Hooks Library" description="A collection of modern, server-safe React hooks – from the ui.dev team" > -