- Split Banner.tsx into reusable components (Header, Footer, NavCard) - Extract custom hooks: useTypewriter, useParallax - Separate navigation data from components into data/navigation.ts - Add TypeScript types (NavItem) for type safety - Configure @ path alias in tsconfig.app.json for consistency - Remove unused dependencies: radix-ui, react-helmet-async - Organize components into layout/ and ui/ directories
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import { useTypewriter } from "@/hooks/useTypewriter";
|
|
import { useParallax } from "@/hooks/useParallax";
|
|
import { NAV_ITEMS } from "@/data/navigation";
|
|
import Header from "@/components/layout/Header";
|
|
import Footer from "@/components/layout/Footer";
|
|
import NavCard from "@/components/NavCard";
|
|
import bannerImg from "@/assets/banner.png";
|
|
|
|
const FULL_TEXT = "Xiaozhou's Website";
|
|
|
|
export default function Banner() {
|
|
const text = useTypewriter(FULL_TEXT, 100);
|
|
const parallaxRef = useParallax(0.25);
|
|
|
|
return (
|
|
<div
|
|
ref={parallaxRef}
|
|
className="relative w-full h-screen flex flex-col justify-between text-white overflow-hidden font-mono select-none"
|
|
style={{
|
|
backgroundImage: `url(${bannerImg})`,
|
|
backgroundSize: "cover",
|
|
}}
|
|
>
|
|
<div className="absolute inset-0 bg-black/45 pointer-events-none" />
|
|
|
|
<Header />
|
|
|
|
<main className="relative z-10 flex-1 flex flex-col items-center justify-center px-4 -translate-y-4">
|
|
<h1 className="text-5xl md:text-7xl lg:text-8xl font-extrabold tracking-tighter text-transparent bg-clip-text bg-linear-to-r from-emerald-50 via-white to-emerald-50 drop-shadow-[0_0_15px_rgba(52,211,153,0.4)]">
|
|
{text}
|
|
<span className="animate-pulse text-emerald-400 ml-0.5">|</span>
|
|
</h1>
|
|
|
|
<p className="mt-5 text-emerald-400/80 text-sm md:text-base tracking-tight font-light">
|
|
{"< / Code. Deploy. Repeat. >"}
|
|
</p>
|
|
|
|
<div className="w-12 h-0.5 bg-emerald-500 mt-5 shadow-[0_0_8px_#10b981]" />
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-5 gap-6 mt-14 w-full max-w-6xl px-4">
|
|
{NAV_ITEMS.map((item) => (
|
|
<NavCard key={item.name} item={item} />
|
|
))}
|
|
</div>
|
|
</main>
|
|
|
|
<Footer />
|
|
</div>
|
|
);
|
|
}
|