docs: add inline comments across components and hooks
This commit is contained in:
1 parent
e2c020a641
commit
f7770bb8af
9 files changed
+22
-9
No files matched your search
@@ -8,6 +8,7 @@ import bannerImg from "@/assets/banner.png";
|
||||
|
||||
const FULL_TEXT = "Xiaozhou's Website";
|
||||
|
||||
// Full-screen hero banner with parallax background, typewriter title, and nav cards
|
||||
export default function Banner() {
|
||||
const text = useTypewriter(FULL_TEXT, 100);
|
||||
const parallaxRef = useParallax(0.25);
|
||||
@@ -21,11 +22,13 @@ export default function Banner() {
|
||||
backgroundSize: "cover",
|
||||
}}
|
||||
>
|
||||
{/* Dark overlay for text readability */}
|
||||
<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">
|
||||
{/* Animated typewriter heading */}
|
||||
<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>
|
||||
@@ -35,8 +38,10 @@ export default function Banner() {
|
||||
{"< / Code. Deploy. Repeat. >"}
|
||||
</p>
|
||||
|
||||
{/* Decorative divider */}
|
||||
<div className="w-12 h-0.5 bg-emerald-500 mt-5 shadow-[0_0_8px_#10b981]" />
|
||||
|
||||
{/* Navigation card grid */}
|
||||
<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} />
|
||||
|
||||
@@ -4,6 +4,7 @@ interface NavCardProps {
|
||||
item: NavItem;
|
||||
}
|
||||
|
||||
// A clickable navigation card with icon, title, and description
|
||||
export default function NavCard({ item }: NavCardProps) {
|
||||
const { name, desc, path, Icon, color, borderHover } = item;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ChevronDown } from "lucide-react";
|
||||
|
||||
// Bottom section with scroll indicator and tech stack credit
|
||||
export default function Footer() {
|
||||
return (
|
||||
<footer className="relative z-10 w-full pb-6 flex flex-col items-center justify-center gap-4 bg-linear-to-t from-black/40 to-transparent">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { LayoutDashboard, GitFork } from "lucide-react";
|
||||
import type { NavItem } from "@/types";
|
||||
|
||||
// External links displayed as navigation cards on the banner
|
||||
export const NAV_ITEMS: NavItem[] = [
|
||||
{
|
||||
name: "Blog",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
// Moves the element's background vertically on scroll for a parallax effect
|
||||
export function useParallax(speed = 0.25) {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
// Reveals `text` one character at a time at the given `speed` (ms per char)
|
||||
export function useTypewriter(text: string, speed = 100) {
|
||||
const [displayed, setDisplayed] = useState("");
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
// Merges Tailwind classes, resolving conflicts via tailwind-merge
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
+10
-9
@@ -1,10 +1,11 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import App from "./App";
|
||||
import './index.css'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import App from "./App";
|
||||
import './index.css'
|
||||
|
||||
// Entry point — mounts the React app into the DOM
|
||||
ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
|
||||
// Shape of a navigation card item used on the banner
|
||||
export interface NavItem {
|
||||
name: string;
|
||||
desc: string;
|
||||
|
||||
Reference in new issue
Block a user