diff --git a/src/app/(website)/components/Home/Hero/02-data.tsx b/src/app/(website)/components/Home/Hero/02-data.tsx index 5a90207..b3be3ba 100644 --- a/src/app/(website)/components/Home/Hero/02-data.tsx +++ b/src/app/(website)/components/Home/Hero/02-data.tsx @@ -28,14 +28,27 @@ export default function HeroData({ return (
- {itemArray.map((item) => ( - + {itemArray.map((item, i) => ( + ))}
); } -const Item = ({ title, item }: { title: string; item: HeroItem }) => { +const Item = ({ + title, + item, + last, +}: { + title: string; + item: HeroItem; + last: boolean; +}) => { const { height } = useWindow(); const containerRef = useRef(null); @@ -47,13 +60,13 @@ const Item = ({ title, item }: { title: string; item: HeroItem }) => { const yp = 0.7; const yoffset = useTransform( scrollYProgress, - [0.2, 0.8], - [-height * yp, height * yp] + [0.2, last ? 0.5 : 0.8], + [-height * yp, last ? 0 : height * yp] ); const opacity = useTransform( scrollYProgress, [0.3, 0.4, 0.6, 0.7], - [0, 1, 1, 0] + [0, 1, 1, last ? 1 : 0] ); return ( diff --git a/src/app/(website)/components/Home/Projects/index.tsx b/src/app/(website)/components/Home/Projects/index.tsx new file mode 100644 index 0000000..792a329 --- /dev/null +++ b/src/app/(website)/components/Home/Projects/index.tsx @@ -0,0 +1,73 @@ +"use client"; + +import { HomeProject, Project } from "@payload-types"; +import { RichText } from "@payloadcms/richtext-lexical/react"; +import { motion, useScroll, useTransform } from "motion/react"; +import { useRef } from "react"; + +export default function Projects({ + text, + projects, +}: { + text: HomeProject; + projects: Project[]; +}) { + const containerRef = useRef(null); + const { scrollYProgress } = useScroll({ + target: containerRef, + offset: ["start end", "start start"], + }); + + const bannerHeight = useTransform(scrollYProgress, [0.6, 1], [0, 1]); + const headerOpacity = useTransform(scrollYProgress, [0.8, 1], [0, 1]); + const textOpacity = useTransform(scrollYProgress, [0.9, 1], [0, 1]); + + return ( +
+
+
+ +
+ + {text.projectsTitle} + + + {text.projectsDescription && ( + + )} + +
+
+
+
+ {[...projects, ...projects].map((project, i) => ( +
+

{project.title}

+ +
+ +
+
+ ))} +
+
+ ); +} diff --git a/src/app/(website)/page.tsx b/src/app/(website)/page.tsx index b14b1c0..5b22617 100644 --- a/src/app/(website)/page.tsx +++ b/src/app/(website)/page.tsx @@ -1,25 +1,30 @@ import { getPayload } from "payload"; import config from "@payload-config"; -import ScrollingNumbers from "./components/Home/ScrollingNumbers"; -import { letters } from "./components/Home/letters"; import HeroIntro from "./components/Home/Hero/01-intro"; import SmoothScroll from "./components/SmoothScroll"; import HeroData from "./components/Home/Hero/02-data"; import bgImage from "./bg.jpg"; import Image from "next/image"; - -const randomNumbers = Array.from({ length: 10 }).map((i) => - Array.from({ length: 20 }).map( - (j) => letters[Math.floor(Math.random() * letters.length)] - ) -); +import Projects from "./components/Home/Projects"; +import Link from "next/link"; export default async function Home() { const payload = await getPayload({ config }); const { titleGroup, heroGroup } = await payload.findGlobal({ slug: "homeHero", }); + const projectsText = await payload.findGlobal({ + slug: "homeProjects", + }); + const projects = await payload.find({ + collection: "projects", + where: { + featured: { + equals: true, + }, + }, + }); return ( @@ -38,6 +43,16 @@ export default async function Home() { desc={heroGroup.heroDescription} /> + + +
+
+

Have a project idea?

+ +

Get in touch >

+ +
+
);