diff --git a/components/Hero/Hero.tsx b/components/Hero/Hero.tsx index 06c834a6..94242f79 100644 --- a/components/Hero/Hero.tsx +++ b/components/Hero/Hero.tsx @@ -1,140 +1,239 @@ "use client"; -import { useState } from "react"; -import "atropos/css"; -import Atropos from "atropos/react"; -import Image from "next/image"; -import space from "public/images/home/space.jpg"; -import rocketman from "public/images/home/rocketman.png"; -import moon from "public/images/home/moon.png"; +import React, { useState, useEffect } from "react"; -export default function Hero() { - const [rocketLoaded, setRocketLoaded] = useState(false); - const [moonLoaded, setMoonLoaded] = useState(false); - const [starsLoaded, setStarsLoaded] = useState(false); - - const isReady = rocketLoaded && moonLoaded && starsLoaded; +const CoduLogo = ({ className }: { className?: string }) => { + return ( + + + + + + + ); +}; - const handleScroll = (id: string) => { - const element = document.getElementById(id); - if (element) { - element.scrollIntoView({ behavior: "smooth" }); +const NightSky = () => { + const styles = ` + @keyframes twinkle { + 0%, 100% { opacity: 0.3; } + 50% { opacity: 0.7; } + } + @keyframes gentleMove1 { + 0%, 100% { transform: translate(0, 0); } + 50% { transform: translate(3px, 2px); } + } + @keyframes gentleMove2 { + 0%, 100% { transform: translate(0, 0); } + 50% { transform: translate(-2px, 4px); } } + @keyframes gentleMove3 { + 0%, 100% { transform: translate(0, 0); } + 50% { transform: translate(4px, -3px); } + } + @keyframes shootingStar { + 0% { transform: translate(0, 0); opacity: 1; } + 100% { transform: translate(300px, 300px); opacity: 0; } + } + .twinkle { animation: twinkle 4s ease-in-out infinite; } + .gentle-move1 { animation: gentleMove1 25s ease-in-out infinite; } + .gentle-move2 { animation: gentleMove2 30s ease-in-out infinite; } + .gentle-move3 { animation: gentleMove3 35s ease-in-out infinite; } + .shooting-star { + position: absolute; + width: 4px; + height: 4px; + background: white; + border-radius: 50%; + top: -4px; + left: -4px; + animation: shootingStar 1.5s linear; + animation-iteration-count: 1; + } + `; + + const [shootingStars, setShootingStars] = useState([]); + useEffect(() => { + const createShootingStar = () => { + const id = Date.now(); + setShootingStars((prev) => [...prev, id]); + setTimeout(() => { + setShootingStars((prev) => prev.filter((starId) => starId !== id)); + }, 1500); // Match the duration of the shooting star animation + }; + + const interval = setInterval(() => { + if (Math.random() < 0.3) { + // 30% chance every 3 seconds + createShootingStar(); + } + }, 3000); + + return () => clearInterval(interval); + }, []); + + const starPositions = [ + { x: 10, y: 15 }, + { x: 25, y: 30 }, + { x: 40, y: 10 }, + { x: 60, y: 40 }, + { x: 75, y: 20 }, + { x: 5, y: 50 }, + { x: 30, y: 70 }, + { x: 50, y: 85 }, + { x: 80, y: 60 }, + { x: 90, y: 35 }, + { x: 15, y: 25 }, + { x: 35, y: 45 }, + { x: 55, y: 15 }, + { x: 70, y: 55 }, + { x: 85, y: 30 }, + { x: 20, y: 65 }, + { x: 45, y: 80 }, + { x: 65, y: 5 }, + { x: 95, y: 45 }, + { x: 8, y: 90 }, + { x: 28, y: 18 }, + { x: 48, y: 38 }, + { x: 68, y: 78 }, + { x: 88, y: 22 }, + { x: 12, y: 72 }, + { x: 32, y: 92 }, + { x: 52, y: 62 }, + { x: 72, y: 42 }, + { x: 92, y: 82 }, + { x: 18, y: 52 }, + { x: 38, y: 32 }, + { x: 58, y: 72 }, + { x: 78, y: 12 }, + { x: 98, y: 58 }, + { x: 3, y: 83 }, + { x: 23, y: 3 }, + { x: 43, y: 93 }, + { x: 63, y: 33 }, + { x: 83, y: 73 }, + { x: 7, y: 37 }, + ]; + + const seededRandom = (function () { + const seed = 12345; // You can change this seed to get a different, but consistent, pattern + let state = seed; + return function () { + state = (state * 1664525 + 1013904223) % 4294967296; + return state / 4294967296; + }; + })(); + + const generateStars = () => { + return starPositions.map((pos, i) => ( + 0.7 ? "twinkle" : ""} + /> + )); + }; + + const generateAnimatedStars = () => { + const animatedStarPositions = [ + { x: 20, y: 20 }, + { x: 45, y: 55 }, + { x: 70, y: 30 }, + { x: 85, y: 75 }, + { x: 15, y: 80 }, + { x: 55, y: 25 }, + { x: 35, y: 65 }, + { x: 65, y: 50 }, + { x: 10, y: 40 }, + { x: 90, y: 10 }, + ]; + return animatedStarPositions.map((pos, i) => ( + + )); }; return ( -
- + + - { - setStarsLoaded(true); - }} - /> - -
-
- Photograph of the moon { - setMoonLoaded(true); - }} - /> -
-
- 3D claymation style model of a astronaut on a rocket { - setRocketLoaded(true); - }} - /> -
-
+ {generateStars()} + {generateAnimatedStars()} + + {shootingStars.map((id) => ( +
+ ))} +
+ ); +}; -
- Codú logo +export default function Hero() { + return ( +
+
+
+ +
+
-
-
- -
+ + ); } diff --git a/e2e/home.spec.ts b/e2e/home.spec.ts index 08e7fc69..0a343954 100644 --- a/e2e/home.spec.ts +++ b/e2e/home.spec.ts @@ -5,16 +5,11 @@ test.describe("Confirm homepage content", () => { await page.goto("http://localhost:3000/"); // Check headers - await expect(page.locator("h1")).toContainText("A space for coders"); - await expect(page.locator("h1")).not.toContainText("Unwanted text"); - - await expect(page.locator("h2")).toContainText( - "Sign up today to become a writer and get a free invite to our Discord community", + await expect(page.locator("h1")).toContainText( + "The free web developer community", ); await expect(page.locator("h3")).toContainText("Trending"); - - await expect(page.locator("h3")).toContainText("Trending"); }); test.describe("Confirm image accessibiliy content", () => { diff --git a/package-lock.json b/package-lock.json index 8e5e2eff..7b173a1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,6 @@ "@trpc/react-query": "^10.45.1", "@trpc/server": "^10.45.1", "algoliasearch": "^5.7.0", - "atropos": "^2.0.2", "clsx": "^2.1.1", "copy-to-clipboard": "^3.3.3", "drizzle-orm": "^0.34.1", @@ -9490,14 +9489,6 @@ "astring": "bin/astring" } }, - "node_modules/atropos": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/atropos/-/atropos-2.0.2.tgz", - "integrity": "sha512-8f0u0hEOlBTWTSvzY17TcHuQjxUIpkTBq70/I4+UF5B43ORtOoRjm8TPBYEgLM8Ba9AWf6PDtkagbYoybdjaKg==", - "engines": { - "node": ">= 12.0.0" - } - }, "node_modules/autoprefixer": { "version": "10.4.20", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.20.tgz", diff --git a/package.json b/package.json index cc410ea5..63499659 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "@trpc/react-query": "^10.45.1", "@trpc/server": "^10.45.1", "algoliasearch": "^5.7.0", - "atropos": "^2.0.2", "clsx": "^2.1.1", "copy-to-clipboard": "^3.3.3", "drizzle-orm": "^0.34.1", diff --git a/public/images/home/moon.png b/public/images/home/moon.png deleted file mode 100644 index 78a15ddf..00000000 Binary files a/public/images/home/moon.png and /dev/null differ diff --git a/public/images/home/rocketman.png b/public/images/home/rocketman.png deleted file mode 100644 index a6d743e5..00000000 Binary files a/public/images/home/rocketman.png and /dev/null differ diff --git a/public/images/home/space.jpg b/public/images/home/space.jpg deleted file mode 100644 index 5ae21c63..00000000 Binary files a/public/images/home/space.jpg and /dev/null differ