Transform the Diffraction Works portfolio into a highly responsive and interactive experience by implementing scroll-triggered animations, enhanced hover effects, theme toggle, loading states, and touch gesture support.
- Next.js 15.5.9 with React 19.2.1
- Tailwind CSS with dark mode already configured
- shadcn/ui components installed
- Basic fade-in animation exists in globals.css
- Mobile navigation already implemented
- use-mobile hook exists for responsive detection
New TypeScript interfaces and types for animation and theme systems.
// src/hooks/use-scroll-animation.ts
interface ScrollAnimationOptions {
threshold?: number;
rootMargin?: string;
triggerOnce?: boolean;
}
interface ScrollAnimationReturn {
ref: React.RefObject<HTMLElement>;
isInView: boolean;
hasAnimated: boolean;
}
// src/components/ThemeProvider.tsx
type Theme = 'light' | 'dark' | 'system';
interface ThemeContextType {
theme: Theme;
setTheme: (theme: Theme) => void;
resolvedTheme: 'light' | 'dark';
}
// src/hooks/use-swipe.ts
interface SwipeOptions {
onSwipeLeft?: () => void;
onSwipeRight?: () => void;
onSwipeUp?: () => void;
onSwipeDown?: () => void;
threshold?: number;
}
interface SwipeReturn {
ref: React.RefObject<HTMLElement>;
swipeDirection: 'left' | 'right' | 'up' | 'down' | null;
}src/hooks/use-scroll-animation.ts- Intersection Observer hook for scroll animationssrc/components/ScrollReveal.tsx- Reusable scroll reveal wrapper componentsrc/components/ThemeProvider.tsx- Theme context provider with next-themes patternsrc/components/ThemeToggle.tsx- Toggle button with sun/moon iconssrc/components/ui/skeleton-card.tsx- Project card skeleton loadersrc/components/ui/skeleton-hero.tsx- Hero section skeleton loadersrc/components/PageLoader.tsx- Full page loading transitionsrc/hooks/use-swipe.ts- Swipe gesture detection hooksrc/components/MobileCarousel.tsx- Swipeable project carousel for mobile
src/app/layout.tsx- Add ThemeProvider wrapper, remove hardcoded dark classsrc/app/globals.css- Add new keyframe animations (pulse, glow, float, slide)src/components/Hero.tsx- Add parallax background effects, scroll animationssrc/components/ProjectShowcase.tsx- Staggered card reveal animations, mobile carouselsrc/components/ProjectCard.tsx- Magnetic hover effect, glow borders, scale transformssrc/components/PhotographyFeed.tsx- Fade-in animations, loading placeholderssrc/components/ContactSection.tsx- Slide-in animations for content sectionssrc/components/Navigation.tsx- Link hover underline animations, theme toggle buttonsrc/components/Footer.tsx- Social icon bounce effects
useScrollAnimation(options)- Returns ref and animation state for scroll-triggered animationsuseSwipe(options)- Returns ref and swipe direction for touch gesturesThemeProvider({ children })- Provides theme context to entire appThemeToggle()- Renders theme toggle button with iconsScrollReveal({ children, animation, delay })- Wrapper component for scroll animationsMobileCarousel({ items })- Renders swipeable carousel for mobileSkeletonCard()- Renders project card skeletonSkeletonHero()- Renders hero section skeletonPageLoader()- Renders full-page loading transition
Navigation()- Add theme toggle button, improve mobile menu transitionsHero()- Add parallax effects, entrance animationsProjectCard()- Add magnetic hover, glow effects, improved transitionsProjectShowcase()- Add scroll-triggered stagger animationsPhotographyFeed()- Add loading states, fade-in animationsContactSection()- Add slide-in animations on scroll
.animate-slide-up- Slide up animation.animate-slide-in-left- Slide in from left.animate-slide-in-right- Slide in from right.animate-scale-in- Scale up animation.animate-glow- Glow pulse animation.animate-float- Floating animation.magnetic-hover- Magnetic cursor follow effect.card-glow- Card glow on hover
.fade-in- Enhanced with transform and timing options- Navigation link classes - Add underline animation
- Project card classes - Add hover transforms and glow
No new dependencies required - using existing:
tailwindcss-animatefor animationslucide-reactfor icons- Radix UI primitives for accessibility
- Native Intersection Observer API
- Native matchMedia API for theme
- Verify scroll animations trigger at correct thresholds
- Test theme toggle persists across page reloads (localStorage)
- Check skeleton states render correctly during loading
- Validate touch gestures work on mobile (swipe detection)
- Ensure all hover effects work smoothly on desktop
- Test reduced motion preferences (accessibility)
- Verify no layout shift during animations
- Create utility hooks (use-scroll-animation, use-swipe)
- Add theme system (ThemeProvider, ThemeToggle, update layout)
- Implement scroll animations (ScrollReveal component, update sections)
- Add loading states (skeleton components)
- Enhance hover effects (update cards, navigation, footer)
- Add touch gestures (mobile carousel)
- Final responsive polish across all components