|
1 | 1 | import { ArrowRightIcon } from "lucide-react";
|
2 |
| -import { Button } from "../common/button"; |
3 | 2 | import { OPEN_SOURCE } from "@/app/_constants/open-source";
|
4 | 3 | import Link from "next/link";
|
5 | 4 | import Image from "next/image";
|
6 | 5 | import { addBasePath } from "@/app/_lib/add-base-path";
|
| 6 | +import { useScroll, useTransform, motion } from "framer-motion"; |
| 7 | +import { useRef } from "react"; |
| 8 | +import clsx from "clsx"; |
7 | 9 |
|
8 | 10 | export default function OpenSource() {
|
| 11 | + const sectionRef = useRef(null); |
| 12 | + |
| 13 | + const { scrollYProgress } = useScroll({ |
| 14 | + target: sectionRef, |
| 15 | + offset: ["start 0.9", "start 0.8"], |
| 16 | + }); |
| 17 | + |
| 18 | + const backgroundColor = useTransform(scrollYProgress, [0, 1], ["#FFFFFF", "#000000"]); |
| 19 | + const titleColor = useTransform(scrollYProgress, [0, 1], ["#071414", "#E6FDFC"]); |
| 20 | + const textColor = useTransform(scrollYProgress, [0, 1], ["#767676", "#BEBEBE"]); |
| 21 | + const buttonColor = useTransform(scrollYProgress, [0, 1], ["#002424", "#E6FDFC"]); |
| 22 | + |
9 | 23 | return (
|
10 |
| - <div className="flex w-full flex-col bg-[linear-gradient(0deg,_#000_90%,_rgba(0,0,0,0)_100%)] items-center gap-20 pb-[100px] pt-[200px] px-4 md:pb-0 md:px-8"> |
11 |
| - <div className="flex flex-col md:items-center md:text-center gap-6"> |
12 |
| - <h2 className="font-oceanic text-[24px] leading-normal md:text-[40px] md:leading-[46px] text-[#E6FDFC] md:whitespace-pre-line"> |
| 24 | + <motion.div style={{ backgroundColor }} className={clsx(["flex w-full flex-col items-center gap-20 pb-[100px] pt-[200px] md:pb-0 md:px-8 duration-1000 transition-all"])}> |
| 25 | + <div ref={sectionRef} className="flex flex-col md:items-center md:text-center gap-6 px-4"> |
| 26 | + <motion.h2 style={{ color: titleColor }} className={clsx(["font-oceanic text-[24px] leading-normal md:text-[40px] md:leading-[46px] md:whitespace-pre-line duration-700 transition-all"])}> |
13 | 27 | {"Based on powerful\nOpen Source Ecosystem"}
|
14 |
| - </h2> |
15 |
| - <p className="text-base text-[#BEBEBE] md:text-lg md:whitespace-pre-line"> |
| 28 | + </motion.h2> |
| 29 | + <motion.p style={{ color: textColor }} className={clsx(["text-base md:text-lg md:whitespace-pre-line duration-700 transition-all"])}> |
16 | 30 | Wrtn Agent OS is built on a powerful and reliable Wrtn Labs Open
|
17 | 31 | Source Ecosystem
|
18 |
| - </p> |
| 32 | + </motion.p> |
19 | 33 |
|
20 | 34 | <Link href="https://github.com./wrtnlabs" target="_blank">
|
21 |
| - <Button variant="secondary" className="text-[#E6FDFC] border-[#E6FDFC]"> |
| 35 | + <motion.button style={{ color: buttonColor, borderColor: buttonColor }} className="text-sm border rounded-full cursor-pointer flex gap-2 px-6 py-[14px] transition-all duration-300"> |
22 | 36 | Our Ecosystem <ArrowRightIcon strokeWidth={1.5} size={20} />
|
23 |
| - </Button> |
| 37 | + </motion.button> |
24 | 38 | </Link>
|
25 | 39 | </div>
|
26 | 40 |
|
@@ -71,6 +85,6 @@ export default function OpenSource() {
|
71 | 85 | </Link>
|
72 | 86 | ))}
|
73 | 87 | </div>
|
74 |
| - </div> |
| 88 | + </motion.div > |
75 | 89 | );
|
76 | 90 | }
|
0 commit comments