diff --git a/apps/web/app/(landing)/CardPatterns/AnimatedGrid.tsx b/apps/web/app/(landing)/CardPatterns/AnimatedGrid.tsx new file mode 100644 index 00000000..31f9e52c --- /dev/null +++ b/apps/web/app/(landing)/CardPatterns/AnimatedGrid.tsx @@ -0,0 +1,149 @@ +"use client"; + +import { cn } from "@repo/ui/lib/utils"; +import { motion } from "framer-motion"; +import { useEffect, useId, useRef, useState } from "react"; + +interface GridPatternProps { + width?: number; + height?: number; + x?: number; + y?: number; + strokeDasharray?: any; + numSquares?: number; + className?: string; + maxOpacity?: number; + duration?: number; + repeatDelay?: number; +} + +export function GridPattern({ + width = 40, + height = 40, + x = -1, + y = -1, + strokeDasharray = 0, + numSquares = 50, + className, + maxOpacity = 0.5, + duration = 4, + repeatDelay = 0.5, + ...props +}: GridPatternProps) { + const id = useId(); + const containerRef = useRef(null); + const [dimensions, setDimensions] = useState({ width: 0, height: 0 }); + const [squares, setSquares] = useState(() => generateSquares(numSquares)); + + function getPos() { + return [ + Math.floor((Math.random() * dimensions.width) / width), + Math.floor((Math.random() * dimensions.height) / height), + ]; + } + + // Adjust the generateSquares function to return objects with an id, x, and y + function generateSquares(count: number) { + return Array.from({ length: count }, (_, i) => ({ + id: i, + pos: getPos(), + })); + } + + // Function to update a single square's position + const updateSquarePosition = (id: number) => { + setSquares((currentSquares) => + currentSquares.map((sq) => + sq.id === id + ? { + ...sq, + pos: getPos(), + } + : sq, + ), + ); + }; + + // Update squares to animate in + useEffect(() => { + if (dimensions.width && dimensions.height) { + setSquares(generateSquares(numSquares)); + } + }, [dimensions, numSquares]); + + // Resize observer to update container dimensions + useEffect(() => { + const resizeObserver = new ResizeObserver((entries) => { + for (let entry of entries) { + setDimensions({ + width: entry.contentRect.width, + height: entry.contentRect.height, + }); + } + }); + + if (containerRef.current) { + resizeObserver.observe(containerRef.current); + } + + return () => { + if (containerRef.current) { + resizeObserver.unobserve(containerRef.current); + } + }; + }, [containerRef]); + + return ( + + ); +} + +export default GridPattern; diff --git a/apps/web/app/(landing)/CardPatterns/Glare.tsx b/apps/web/app/(landing)/CardPatterns/Glare.tsx index 8fefb309..53550ecc 100644 --- a/apps/web/app/(landing)/CardPatterns/Glare.tsx +++ b/apps/web/app/(landing)/CardPatterns/Glare.tsx @@ -130,7 +130,7 @@ export const GlareCard = ({
diff --git a/apps/web/app/(landing)/Cta.tsx b/apps/web/app/(landing)/Cta.tsx index 79881055..128581e8 100644 --- a/apps/web/app/(landing)/Cta.tsx +++ b/apps/web/app/(landing)/Cta.tsx @@ -1,14 +1,21 @@ import Image from "next/image"; import React from "react"; import EmailInput from "./EmailInput"; +import GridPattern from "./CardPatterns/AnimatedGrid"; +import { cn } from "@repo/ui/lib/utils"; +import { ChevronRight } from "lucide-react"; +import { Gradient } from "./Features/features"; +// import {Animated} function Cta() { return (
+ Launching July 1st, 2024
+
- Time to change that.
Sign up for the waitlist and be the first to
- try Supermemory
+
+ Sign up for the waitlist and be the first to try Supermemory
-
- Supermemory offers all the vital building blocks you need to transform your idea into a great-looking startup.
-
{
+ return (
+ +
Well Integrated with six companies so far @@ -40,13 +103,13 @@ const AnimatedLogoCloud = () => { {/*