diff --git a/ui/src/pages/login.tsx b/ui/src/pages/login.tsx index 8438502..65e095a 100644 --- a/ui/src/pages/login.tsx +++ b/ui/src/pages/login.tsx @@ -7,7 +7,7 @@ import { Label } from "@ui/components/ui/label"; import { useTheme } from "@ui/contexts/ThemeContext"; import { useLoginEmail } from "@ui/hooks/auth"; import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react"; -import { useState } from "react"; +import { useRef, useState } from "react"; import { Link } from "react-router-dom"; import { twMerge } from "tailwind-merge"; @@ -25,6 +25,33 @@ export function LoginPage() { password: "", }); + // 3D Parallax effect + const cardRef = useRef(null); + const [transform, setTransform] = useState(""); + + const handleMouseMove = (e: React.MouseEvent) => { + if (!cardRef.current) return; + + const card = cardRef.current; + const rect = card.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + const centerX = rect.width / 2; + const centerY = rect.height / 2; + + const rotateX = ((y - centerY) / centerY) * -10; // Max 10 degrees tilt + const rotateY = ((x - centerX) / centerX) * 10; + + setTransform( + `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale3d(1.02, 1.02, 1.02)` + ); + }; + + const handleMouseLeave = () => { + setTransform(""); + }; + // Theme const { theme, setTheme } = useTheme(); @@ -63,10 +90,15 @@ export function LoginPage() {
e.stopPropagation()} >
diff --git a/ui/src/pages/signup.tsx b/ui/src/pages/signup.tsx index 2ba5017..f5f6e28 100644 --- a/ui/src/pages/signup.tsx +++ b/ui/src/pages/signup.tsx @@ -7,7 +7,7 @@ import { Label } from "@ui/components/ui/label"; import { useTheme } from "@ui/contexts/ThemeContext"; import { useSignUp } from "@ui/hooks/auth"; import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react"; -import { useState } from "react"; +import { useRef, useState } from "react"; import { Link, useNavigate } from "react-router-dom"; import { twMerge } from "tailwind-merge"; @@ -29,6 +29,33 @@ export function SignUpPage() { business_name: "", }); + // 3D Parallax effect + const cardRef = useRef(null); + const [transform, setTransform] = useState(""); + + const handleMouseMove = (e: React.MouseEvent) => { + if (!cardRef.current) return; + + const card = cardRef.current; + const rect = card.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + const centerX = rect.width / 2; + const centerY = rect.height / 2; + + const rotateX = ((y - centerY) / centerY) * -10; // Max 10 degrees tilt + const rotateY = ((x - centerX) / centerX) * 10; + + setTransform( + `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale3d(1.02, 1.02, 1.02)` + ); + }; + + const handleMouseLeave = () => { + setTransform(""); + }; + // Theme const { theme, setTheme } = useTheme(); @@ -109,10 +136,15 @@ export function SignUpPage() { >
e.stopPropagation()} >