From cd590553b6f9b3a98cf01ec0073c43060a7459d0 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Fri, 30 Jan 2026 15:29:53 +0100 Subject: [PATCH] feat: enhance dashboard preview with scroll-based animations using framer-motion, improving interactivity and visual dynamics --- app/page.tsx | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index bca8ca9..2a7cb48 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,8 +1,8 @@ 'use client' -import { useEffect, useState } from 'react' +import { useEffect, useState, useRef } from 'react' import Link from 'next/link' -import { motion } from 'framer-motion' +import { motion, useScroll, useTransform } from 'framer-motion' import { useAuth } from '@/lib/auth/context' import { initiateOAuthFlow, initiateSignupFlow } from '@/lib/api/oauth' import { listSites, deleteSite, type Site } from '@/lib/api/sites' @@ -13,19 +13,32 @@ import { BarChartIcon, LockIcon, ZapIcon, CheckCircleIcon, XIcon } from '@cipher import { toast } from '@ciphera-net/ui' function DashboardPreview() { + const containerRef = useRef(null) + + const { scrollYProgress } = useScroll({ + target: containerRef, + offset: ["start end", "end end"] + }) + + const rotateX = useTransform(scrollYProgress, [0, 1], [30, 0]) + const scale = useTransform(scrollYProgress, [0, 1], [0.8, 1]) + const opacity = useTransform(scrollYProgress, [0, 0.8], [0.5, 1]) + return ( -
+
{/* * Glow behind the image */}
{/* * Animated Container */} {/* * Header of the fake browser window */}