From 8f552147ed647983f43222dc825c406b539eb32a Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 3 Jun 2024 23:39:36 +0100 Subject: [PATCH] Updates base layout --- src/components/HomeBackground.tsx | 119 ------------------------------ src/components/Nav.astro | 84 --------------------- src/layouts/Base.astro | 33 ++------- 3 files changed, 6 insertions(+), 230 deletions(-) delete mode 100644 src/components/HomeBackground.tsx delete mode 100644 src/components/Nav.astro diff --git a/src/components/HomeBackground.tsx b/src/components/HomeBackground.tsx deleted file mode 100644 index d1a2b8a..0000000 --- a/src/components/HomeBackground.tsx +++ /dev/null @@ -1,119 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { motion } from 'framer-motion'; -import styled from '@emotion/styled'; - -const dotSpacing = 32; - -const Meteor = styled(motion.div)` - position: absolute; - width: 4px; - height: 4px; - border-radius: 50%; - background-color: #9fef00; - box-shadow: 0 0 15px 3px #9fef00; - - &::before { - content: ''; - position: absolute; - top: -100px; - left: 0; - width: 2px; - height: 100px; - background: linear-gradient(to bottom, #9fef00, transparent); - } -`; - -const StyledSvg = styled.svg` - pointer-events: none; - position: absolute; - inset: 0; - height: 100%; - width: 100%; - fill: rgba(100, 100, 100, 0.5); -`; - -const StyledRect = styled.rect` - width: 100%; - height: 100%; - stroke-width: 0; -`; - -const generateMeteor = (id: number, gridSizeX: number, gridSizeY: number) => { - const column = Math.floor(Math.random() * gridSizeX); - const startRow = Math.floor(Math.random() * (gridSizeY - 12)); - const travelDistance = 5 + Math.floor(Math.random() * 10); // Between 5 and 15 spaces - const duration = 1.5 + Math.random(); // 1.5 to 2.5 seconds duration - - return { - id, - column, - startRow, - endRow: startRow + travelDistance, - duration, - key: Math.random() + Math.random(), - }; -}; - -const DotPattern = ({ className }: { className?: string }) => { - const countOfMeteors = 6; - const [gridSizeX, setGridSizeX] = useState(Math.floor(window.innerWidth / dotSpacing)); - const [gridSizeY, setGridSizeY] = useState(Math.floor(window.innerHeight / dotSpacing)); - const [meteors, setMeteors] = useState(() => Array.from({ length: countOfMeteors }, (_, index) => generateMeteor(index, gridSizeX, gridSizeY))); - - const handleAnimationComplete = (id: number) => { - setMeteors(current => - current.map(meteor => { - if (meteor.id === id) { - return generateMeteor(id, gridSizeX, gridSizeY); - } - return meteor; - }) - ); - }; - - useEffect(() => { - const handleResize = () => { - setGridSizeX(Math.floor(window.innerWidth / dotSpacing)); - setGridSizeY(Math.floor(window.innerHeight / dotSpacing)); - }; - - window.addEventListener('resize', handleResize); - return () => window.removeEventListener('resize', handleResize); - }, []); - - return ( - <> - - - - - - - - - - {meteors.map(({ id, column, startRow, endRow, duration, key }) => ( - handleAnimationComplete(id)} - /> - ))} - - ); -}; - -export default DotPattern; diff --git a/src/components/Nav.astro b/src/components/Nav.astro deleted file mode 100644 index 536ab81..0000000 --- a/src/components/Nav.astro +++ /dev/null @@ -1,84 +0,0 @@ ---- - ---- - - - - - diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index 810cd78..2f178ae 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -1,9 +1,6 @@ --- import { ViewTransitions } from 'astro:transitions' import MetaTags from '@layouts/MetaTags.astro'; -// import NavBar from '@components/scafold/NavBar.astro'; -// import Footer from '@components/scafold/Footer.astro'; -// import config from '../site-config'; import '@styles/typography.scss'; import '@styles/global.scss'; @@ -29,32 +26,14 @@ interface Props { + - - - - -