Footer
FreeA four-column footer with a validated newsletter field, a live status link, a sliding theme switcher, underline-draw hovers and an oversized faded wordmark.
Hide codecomponents/blocks/footer-columns.tsx
"use client";
import { useEffect, useState } from "react";
import { useTheme } from "next-themes";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
import { ArrowUpRight, Check, Loader2, Monitor, Moon, Sun } from "lucide-react";
import { cn } from "@/lib/utils";
const cols = {
Product: ["Features", "Integrations", "Pricing", "Changelog", "Roadmap"],
Developers: ["Docs", "API reference", "SDKs", "Status", "Open source"],
Company: ["About", "Blog", "Careers", "Press kit", "Contact"],
Legal: ["Privacy", "Terms", "DPA", "Security"],
};
const ring = "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background";
const themes = [
{ id: "light", icon: Sun },
{ id: "system", icon: Monitor },
{ id: "dark", icon: Moon },
] as const;
export default function FooterColumnsBlock() {
const reduce = useReducedMotion();
const [email, setEmail] = useState("");
const [state, setState] = useState<"idle" | "loading" | "done" | "error">("idle");
const { theme: current, setTheme } = useTheme();
const [mounted, setMounted] = useState(false);
// eslint-disable-next-line react-hooks/set-state-in-effect
useEffect(() => setMounted(true), []);
const theme = mounted ? (current ?? "system") : null;
function subscribe(e: React.FormEvent) {
e.preventDefault();
if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email.trim())) return setState("error");
setState("loading");
setTimeout(() => setState("done"), 800);
}
return (
<div className="flex min-h-full w-full flex-col justify-end bg-muted/30">
<footer className="relative overflow-hidden border-t border-border bg-background">
<div className="mx-auto max-w-6xl px-4 pb-8 pt-14 sm:px-6">
<div className="grid gap-10 lg:grid-cols-[1.2fr_2fr]">
<div className="max-w-sm">
<div className="flex items-center gap-2 text-[15px] font-semibold tracking-tight">
<span className="grid size-6 place-items-center rounded-md bg-foreground text-[11px] font-bold text-background shadow-[inset_0_1px_0_rgb(255_255_255/0.2)]">N</span>
Northwind
</div>
<p className="mt-3 text-sm text-muted-foreground">Product analytics for teams that ship weekly. One update a month, no spam.</p>
<form noValidate onSubmit={subscribe} className="mt-5">
<label htmlFor="ft-email" className="sr-only">Email</label>
<div className={cn("flex h-9 overflow-hidden rounded-md border bg-card shadow-[inset_0_1px_2px_rgb(0_0_0/0.05)] transition-colors focus-within:border-foreground/30", state === "error" ? "border-red-500/50" : "border-border")}>
<input
id="ft-email"
type="email"
value={email}
disabled={state === "done"}
aria-invalid={state === "error"}
aria-describedby="ft-msg"
onChange={(e) => (setEmail(e.target.value), state === "error" && setState("idle"))}
placeholder="you@company.com"
className="min-w-0 flex-1 bg-transparent px-3 text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"
/>
<button type="submit" disabled={state === "loading" || state === "done"} className={cn("relative w-24 border-l border-border bg-muted/60 text-[13px] font-medium transition-colors hover:bg-muted", ring)}>
<AnimatePresence mode="popLayout" initial={false}>
<motion.span
key={state}
initial={reduce ? { opacity: 0 } : { y: 12, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
exit={reduce ? { opacity: 0 } : { y: -12, opacity: 0 }}
className="inline-flex items-center gap-1"
>
{state === "loading" ? <Loader2 className="size-3.5 animate-spin" aria-hidden /> : state === "done" ? <Check className="size-3.5 text-emerald-500" aria-hidden /> : null}
{state === "loading" ? "" : state === "done" ? "Done" : "Subscribe"}
</motion.span>
</AnimatePresence>
</button>
</div>
<p id="ft-msg" role={state === "error" ? "alert" : "status"} className={cn("mt-1.5 min-h-4 text-xs", state === "error" ? "text-red-600 dark:text-red-400" : "text-muted-foreground")}>
{state === "error" ? "Enter a valid email." : state === "done" ? "Check your inbox to confirm." : ""}
</p>
</form>
</div>
<nav aria-label="Footer" className="grid grid-cols-2 gap-8 sm:grid-cols-4">
{Object.entries(cols).map(([title, links]) => (
<div key={title}>
<h3 className="text-xs font-medium text-foreground">{title}</h3>
<ul className="mt-3 space-y-2">
{links.map((l) => (
<li key={l}>
<a href={`#${l.toLowerCase().replace(/\s/g, "-")}`} onClick={(e) => e.preventDefault()} className={cn("group inline-flex items-center gap-1 rounded-sm text-[13px] text-muted-foreground transition-colors hover:text-foreground", ring)}>
<span className="bg-[linear-gradient(currentColor,currentColor)] bg-[length:0%_1px] bg-left-bottom bg-no-repeat pb-px transition-[background-size] duration-300 group-hover:bg-[length:100%_1px]">{l}</span>
{l === "Status" || l === "Open source" ? <ArrowUpRight className="size-3 opacity-50" aria-hidden /> : null}
</a>
</li>
))}
</ul>
</div>
))}
</nav>
</div>
<div className="mt-12 flex flex-col-reverse items-start justify-between gap-4 border-t border-border pt-6 sm:flex-row sm:items-center">
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted-foreground">
<span>© 2026 Northwind Labs, Inc.</span>
<a href="#status" onClick={(e) => e.preventDefault()} className={cn("inline-flex items-center gap-1.5 rounded-sm hover:text-foreground", ring)}>
<span className="relative flex size-1.5">
{!reduce ? <span className="absolute inset-0 animate-ping rounded-full bg-emerald-500 opacity-50" /> : null}
<span className="relative size-1.5 rounded-full bg-emerald-500" />
</span>
All systems operational
</a>
</div>
<div role="radiogroup" aria-label="Theme" className="flex rounded-md border border-border bg-muted/50 p-0.5">
{themes.map((t) => (
<button key={t.id} type="button" role="radio" aria-checked={theme === t.id} aria-label={`${t.id} theme`} onClick={() => setTheme(t.id)} className={cn("relative grid size-7 place-items-center rounded text-muted-foreground", theme === t.id && "text-foreground", ring)}>
{theme === t.id ? <motion.span layoutId="ft-theme" transition={{ type: "spring", stiffness: 500, damping: 36 }} className="absolute inset-0 rounded bg-background shadow-[0_0_0_1px_var(--border),0_1px_2px_rgb(0_0_0/0.08)]" /> : null}
<t.icon className="relative size-3.5" aria-hidden />
</button>
))}
</div>
</div>
</div>
<div aria-hidden className="pointer-events-none select-none overflow-hidden px-4">
<p className="translate-y-[22%] bg-gradient-to-b from-foreground/[0.09] to-transparent bg-clip-text text-center text-[clamp(4rem,19vw,15rem)] font-semibold leading-none tracking-[-0.06em] text-transparent">northwind</p>
</div>
</footer>
</div>
);
}