feat(ui): complete homepage overhaul with magicui animations, shiftable tools grid, bento grid, 3D visualizer, and marquee reviews

This commit is contained in:
2026-11-04 17:55:18 +05:30
parent 3296e1a6c0
commit 70e13c86b6
22 changed files with 1998 additions and 746 deletions
+105
View File
@@ -0,0 +1,105 @@
'use client';
import React from 'react';
import Link from 'next/link';
import { ArrowRight } from 'lucide-react';
import { cn } from '@/lib/utils';
export function BentoGrid({
children,
className,
}: {
children: React.ReactNode;
className?: string;
}) {
return (
<div
className={cn(
'grid w-full auto-rows-[22rem] grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5',
className
)}
>
{children}
</div>
);
}
export interface BentoCardProps {
name: string;
className?: string;
background?: React.ReactNode;
Icon?: React.ElementType;
description: string;
href?: string;
cta?: string;
badge?: string;
}
export function BentoCard({
name,
className,
background,
Icon,
description,
href,
cta = 'Explore Tool',
badge,
}: BentoCardProps) {
const content = (
<div
className={cn(
'group relative col-span-1 flex flex-col justify-between overflow-hidden rounded-3xl',
'bg-white border border-slate-200/90 shadow-cream-sm',
'transform-gpu transition-all duration-300 hover:-translate-y-1 hover:shadow-cream-lg hover:border-blue-400/60',
className
)}
>
{/* Background Media / Interactive Visualization */}
<div className="absolute inset-0 z-0 overflow-hidden">{background}</div>
{/* Subtle Gradient Overlay */}
<div className="pointer-events-none absolute inset-0 z-10 bg-gradient-to-t from-slate-950/85 via-slate-950/25 to-transparent transition-opacity duration-300" />
{/* Top Header Badge */}
<div className="relative z-20 flex items-center justify-between p-5">
{badge && (
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase text-blue-700 bg-white/90 backdrop-blur-md border border-blue-200 shadow-sm">
{badge}
</span>
)}
{Icon && (
<div className="w-9 h-9 rounded-xl bg-white/90 backdrop-blur-md border border-slate-200/80 flex items-center justify-center text-blue-600 shadow-sm group-hover:scale-110 transition-transform">
<Icon className="w-4 h-4" />
</div>
)}
</div>
{/* Bottom Content Area */}
<div className="relative z-20 flex flex-col gap-2 p-6 text-white">
<h3 className="text-xl font-display font-bold text-white tracking-tight group-hover:text-blue-300 transition-colors">
{name}
</h3>
<p className="text-xs sm:text-sm text-slate-200 line-clamp-2 leading-relaxed">
{description}
</p>
{href && (
<div className="pt-2 flex items-center gap-1 text-xs font-semibold text-blue-300 group-hover:text-white transition-colors">
<span>{cta}</span>
<ArrowRight className="w-3.5 h-3.5 transition-transform group-hover:translate-x-1" />
</div>
)}
</div>
</div>
);
if (href) {
return (
<Link href={href} className="block h-full">
{content}
</Link>
);
}
return content;
}
+58
View File
@@ -0,0 +1,58 @@
'use client';
import React from 'react';
import { cn } from '@/lib/utils';
// Fallback helper in case cn isn't in @/lib/utils
function classNames(...classes: (string | undefined | null | false)[]) {
return classes.filter(Boolean).join(' ');
}
interface MarqueeProps {
className?: string;
reverse?: boolean;
pauseOnHover?: boolean;
children?: React.ReactNode;
vertical?: boolean;
repeat?: number;
[key: string]: any;
}
export function Marquee({
className,
reverse,
pauseOnHover = true,
children,
vertical = false,
repeat = 4,
...props
}: MarqueeProps) {
return (
<div
{...props}
className={classNames(
'group flex overflow-hidden p-2 [--duration:40s] [--gap:1.25rem] [gap:var(--gap)]',
vertical ? 'flex-col' : 'flex-row',
className
)}
>
{Array(repeat)
.fill(0)
.map((_, i) => (
<div
key={i}
className={classNames(
'flex shrink-0 justify-around [gap:var(--gap)]',
vertical
? 'animate-marquee-vertical flex-col'
: 'animate-marquee flex-row',
pauseOnHover && 'group-hover:[animation-play-state:paused]',
reverse && '[animation-direction:reverse]'
)}
>
{children}
</div>
))}
</div>
);
}
+104
View File
@@ -0,0 +1,104 @@
'use client';
import React, { useEffect, useState } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';
export function SmoothCursor() {
const [mounted, setMounted] = useState(false);
const [isHovered, setIsHovered] = useState(false);
const [isVisible, setIsVisible] = useState(false);
const mouseX = useMotionValue(-100);
const mouseY = useMotionValue(-100);
// Smooth spring physics for luxurious trailing movement
const springConfig = { damping: 28, stiffness: 350, mass: 0.5 };
const cursorX = useSpring(mouseX, springConfig);
const cursorY = useSpring(mouseY, springConfig);
useEffect(() => {
// Disable on touch devices
if (typeof window === 'undefined') return;
const isTouch = window.matchMedia('(pointer: coarse)').matches;
if (isTouch) return;
setMounted(true);
const handleMouseMove = (e: MouseEvent) => {
mouseX.set(e.clientX);
mouseY.set(e.clientY);
if (!isVisible) setIsVisible(true);
};
const handleMouseLeave = () => {
setIsVisible(false);
};
const handleMouseEnter = () => {
setIsVisible(true);
};
// Detect clickable/interactive hover targets
const handleMouseOver = (e: MouseEvent) => {
const target = e.target as HTMLElement | null;
if (!target) return;
const isInteractive = target.closest(
'a, button, input, textarea, select, [role="button"], .cursor-pointer'
);
setIsHovered(!!isInteractive);
};
window.addEventListener('mousemove', handleMouseMove);
window.addEventListener('mouseleave', handleMouseLeave);
window.addEventListener('mouseenter', handleMouseEnter);
document.addEventListener('mouseover', handleMouseOver);
return () => {
window.removeEventListener('mousemove', handleMouseMove);
window.removeEventListener('mouseleave', handleMouseLeave);
window.removeEventListener('mouseenter', handleMouseEnter);
document.removeEventListener('mouseover', handleMouseOver);
};
}, [mouseX, mouseY, isVisible]);
if (!mounted || !isVisible) return null;
return (
<div className="pointer-events-none fixed inset-0 z-[9999] overflow-hidden select-none">
{/* Outer fluid halo aura */}
<motion.div
className="fixed top-0 left-0 rounded-full border border-blue-500/40 bg-blue-500/10 backdrop-blur-[1px]"
style={{
x: cursorX,
y: cursorY,
translateX: '-50%',
translateY: '-50%',
}}
animate={{
width: isHovered ? 48 : 28,
height: isHovered ? 48 : 28,
scale: isHovered ? 1.2 : 1,
borderColor: isHovered ? 'rgba(59, 130, 246, 0.7)' : 'rgba(59, 130, 246, 0.35)',
backgroundColor: isHovered ? 'rgba(59, 130, 246, 0.18)' : 'rgba(59, 130, 246, 0.08)',
}}
transition={{ type: 'spring', damping: 25, stiffness: 350 }}
/>
{/* Inner sharp precision dot */}
<motion.div
className="fixed top-0 left-0 w-2 h-2 rounded-full bg-blue-600 shadow-sm"
style={{
x: mouseX,
y: mouseY,
translateX: '-50%',
translateY: '-50%',
}}
animate={{
scale: isHovered ? 0 : 1,
opacity: isHovered ? 0 : 1,
}}
transition={{ duration: 0.15 }}
/>
</div>
);
}
+142
View File
@@ -0,0 +1,142 @@
'use client';
import React from 'react';
import { motion, Variants } from 'framer-motion';
export type AnimationType =
| 'fadeIn'
| 'blurIn'
| 'slideUp'
| 'slideDown'
| 'slideLeft'
| 'slideRight'
| 'scaleUp';
export type AnimateBy = 'character' | 'word' | 'line';
interface TextAnimateProps {
children: string;
className?: string;
delay?: number;
duration?: number;
variants?: Variants;
as?: React.ElementType;
by?: AnimateBy;
startOnView?: boolean;
once?: boolean;
animation?: AnimationType;
}
const defaultItemVariants: Record<AnimationType, Variants> = {
fadeIn: {
hidden: { opacity: 0 },
show: { opacity: 1, transition: { duration: 0.5, ease: [0.16, 1, 0.3, 1] } },
},
blurIn: {
hidden: { opacity: 0, filter: 'blur(8px)', y: 8 },
show: { opacity: 1, filter: 'blur(0px)', y: 0, transition: { duration: 0.6, ease: [0.16, 1, 0.3, 1] } },
},
slideUp: {
hidden: { y: 24, opacity: 0 },
show: { y: 0, opacity: 1, transition: { duration: 0.5, ease: [0.16, 1, 0.3, 1] } },
},
slideDown: {
hidden: { y: -24, opacity: 0 },
show: { y: 0, opacity: 1, transition: { duration: 0.5, ease: [0.16, 1, 0.3, 1] } },
},
slideLeft: {
hidden: { x: 24, opacity: 0 },
show: { x: 0, opacity: 1, transition: { duration: 0.5, ease: [0.16, 1, 0.3, 1] } },
},
slideRight: {
hidden: { x: -24, opacity: 0 },
show: { x: 0, opacity: 1, transition: { duration: 0.5, ease: [0.16, 1, 0.3, 1] } },
},
scaleUp: {
hidden: { scale: 0.85, opacity: 0 },
show: { scale: 1, opacity: 1, transition: { duration: 0.5, ease: [0.16, 1, 0.3, 1] } },
},
};
export function TextAnimate({
children,
delay = 0,
duration = 0.4,
className = '',
as: Component = 'span',
by = 'word',
startOnView = true,
once = true,
animation = 'slideLeft',
}: TextAnimateProps) {
if (typeof children !== 'string') {
return <Component className={className}>{children}</Component>;
}
const itemVariant = defaultItemVariants[animation] || defaultItemVariants.slideLeft;
const containerVariants: Variants = {
hidden: {},
show: {
transition: {
staggerChildren: by === 'character' ? 0.02 : 0.06,
delayChildren: delay,
},
},
};
// If animating by character, group by words to prevent broken line wrapping!
if (by === 'character') {
const words = children.split(' ');
return (
<motion.span
variants={containerVariants}
initial="hidden"
whileInView={startOnView ? 'show' : undefined}
animate={!startOnView ? 'show' : undefined}
viewport={{ once, margin: '-20px' }}
className={`inline-block ${className}`}
>
{words.map((word, wIdx) => (
<span key={wIdx} className="inline-block whitespace-nowrap">
{Array.from(word).map((char, cIdx) => (
<motion.span
key={`${char}-${cIdx}`}
variants={itemVariant}
className="inline-block"
>
{char}
</motion.span>
))}
{wIdx < words.length - 1 && <span>&nbsp;</span>}
</span>
))}
</motion.span>
);
}
// Word or line animation
const segments = by === 'word' ? children.split(' ') : children.split('\n');
return (
<motion.span
variants={containerVariants}
initial="hidden"
whileInView={startOnView ? 'show' : undefined}
animate={!startOnView ? 'show' : undefined}
viewport={{ once, margin: '-20px' }}
className={`inline-block ${className}`}
>
{segments.map((segment, index) => (
<motion.span
key={`${segment}-${index}`}
variants={itemVariant}
className="inline-block"
>
{segment}
{by === 'word' && index < segments.length - 1 && '\u00A0'}
</motion.span>
))}
</motion.span>
);
}