Files
www_projectmycelium_com/src/components/ui/layout-text-flip.tsx
sasha-astiadi ab5ac43793 feat: update website design and assets
- Replaced multiple hero and background images with new optimized versions
- Removed unused image assets from public/images directory
- Updated typography styles:
  - Removed italic styling from various text components
  - Made eyebrow text uppercase
  - Adjusted H1 font size from 6xl to 5xl on mobile
- Redesigned HomeAurora component with new layout and background
- Added Mulish as primary font family in Tailwind config
- Updated text formatting and spacing
2025-10-31 01:36:08 +01:00

59 lines
1.5 KiB
TypeScript

"use client";
import { useState, useEffect } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { cn } from "@/lib/utils";
export const LayoutTextFlip = ({
text = "Build Amazing",
words = ["Landing Pages", "Component Blocks", "Page Sections", "3D Shaders"],
duration = 1500,
}: {
text: string;
words: string[];
duration?: number;
}) => {
const [currentIndex, setCurrentIndex] = useState(0);
useEffect(() => {
const interval = setInterval(() => {
setCurrentIndex((prevIndex) => (prevIndex + 1) % words.length);
}, duration);
return () => clearInterval(interval);
}, []);
return (
<>
<motion.span
layoutId="subtext"
className="text-2xl font-bold tracking-tight drop-shadow-lg md:text-4xl"
>
{text}
</motion.span>
<motion.span
layout
className="relative w-fit overflow-hidden px-2 py-2 font-medium tracking-tight"
>
<AnimatePresence mode="popLayout">
<motion.span
key={currentIndex}
initial={{ y: -40, filter: "blur(10px)" }}
animate={{
y: 0,
filter: "blur(0px)",
}}
exit={{ y: 50, filter: "blur(10px)", opacity: 0 }}
transition={{
duration: 0.5,
}}
className={cn("inline-block whitespace-nowrap")}
>
{words[currentIndex]}
</motion.span>
</AnimatePresence>
</motion.span>
</>
);
};