feat: refresh uses, testimonials, and theme
Uses page: - Merge "For work"/"For fun" into one Hardware list; drop the MS-01. - Gaming rig becomes the Arch "Daily driver" (9950X, Looking Glass VM); custom workstation is now the Proxmox box (5900X, 128GB, RTX 3090). - Swap MetaMCP -> ContextForge and Open WebUI -> Paseo; add Codex, OpenCode, and OpenRouter. Testimonials: - Add Douglas Wilhelm; trim all quotes to ~55-60 words of verbatim sentences so cards stay the same size. - Move above projects and restyle as a card with gold-bordered initials, inline gold quote marks, and a countdown line under the divider. - Fix carousel bugs: hooks after an early return, timer not resetting on manual navigation, layout shift between quotes of different lengths. The countdown animation now drives rotation, and hover/keyboard focus pause it. Theme: - Centralize colors and fonts as CSS variables in globals.css; the neutral-* scale reads from them, and the header's hardcoded bg is gone. - New defaults: Manrope (body), EB Garamond (display), zinc greys, gold. - Add a dev-only theme switcher for A/B-ing fonts and palettes; it is compiled out of production builds. - Remove dead runtime-built hover classes on the about page that never generated CSS. Copy: replace em dashes with plain hyphens site-wide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b6790813b
commit
abd5fd4a58
24 files changed
+765
-313
No files matched your search
@@ -1,8 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import Image from "next/image";
|
||||
import { IconPlayerPauseFilled, IconPlayerPlayFilled, IconPoint, IconPointFilled } from '@tabler/icons-react';
|
||||
import type { Testimonial } from "@/shared/types";
|
||||
import { colors } from "@/constants/colors";
|
||||
|
||||
const ROTATE_MS = 10000;
|
||||
|
||||
function getInitials(name: string) {
|
||||
return name
|
||||
@@ -12,13 +16,6 @@ function getInitials(name: string) {
|
||||
.join("");
|
||||
}
|
||||
|
||||
type Testimonial = {
|
||||
name: string;
|
||||
title: string;
|
||||
avatar?: string;
|
||||
quote: string;
|
||||
};
|
||||
|
||||
type TestimonialsProps = {
|
||||
items: Testimonial[];
|
||||
};
|
||||
@@ -26,68 +23,134 @@ type TestimonialsProps = {
|
||||
export default function Testimonials({ items }: TestimonialsProps) {
|
||||
const [activeIndex, setActiveIndex] = useState(0);
|
||||
const [isPlaying, setIsPlaying] = useState(true);
|
||||
const active = items[activeIndex];
|
||||
// Hovering or focusing the card pauses rotation so nobody loses their place mid-read.
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const [isFocused, setIsFocused] = useState(false);
|
||||
|
||||
if (!active) return null;
|
||||
const shouldRotate = items.length > 1 && isPlaying && !isHovered && !isFocused;
|
||||
|
||||
useEffect(() => {
|
||||
if (items.length <= 1 || !isPlaying) return;
|
||||
if (items.length === 0) return null;
|
||||
|
||||
const id = setInterval(() => {
|
||||
setActiveIndex((i) => (i + 1) % items.length);
|
||||
}, 5000);
|
||||
|
||||
return () => clearInterval(id);
|
||||
}, [items.length, isPlaying]);
|
||||
|
||||
// TODO: fix bug - when clicking a pagination button, the auto-rotation timer doesn't reset, causing it to immediately rotate to the next testimonial after 5 seconds instead of 10
|
||||
// Clamp in case items shrinks underneath us.
|
||||
const current = Math.min(activeIndex, items.length - 1);
|
||||
|
||||
return (
|
||||
<section className="w-full">
|
||||
{/* header: avatar + name + title */}
|
||||
<header className="flex items-center gap-3 mb-2">
|
||||
{active.avatar ? (
|
||||
<Image
|
||||
src={active.avatar}
|
||||
alt={active.name}
|
||||
width={64}
|
||||
height={64}
|
||||
className="rounded-full object-cover size-10"
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
aria-hidden
|
||||
className="size-10 rounded-full bg-neutral-800 flex items-center justify-center text-xs font-medium text-neutral-400"
|
||||
>
|
||||
{getInitials(active.name)}
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
<div className="text-sm font-semibold">{active.name}</div>
|
||||
<div className="text-xs text-neutral-500">{active.title}</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<blockquote className="p-3">"{active.quote}"</blockquote>
|
||||
|
||||
<footer className="flex items-center justify-between">
|
||||
<div className="flex mt-3">
|
||||
{items.map((_, i) => (
|
||||
<button
|
||||
key={i}
|
||||
onClick={() => setActiveIndex(i)}
|
||||
aria-label={`Go to testimonial ${i + 1}`}
|
||||
<section
|
||||
className="w-full"
|
||||
aria-roledescription="carousel"
|
||||
aria-label="Testimonials"
|
||||
onMouseEnter={() => setIsHovered(true)}
|
||||
onMouseLeave={() => setIsHovered(false)}
|
||||
// Only keyboard focus pauses. A mouse click also focuses the dot, and that
|
||||
// focus would otherwise keep rotation paused after the pointer leaves.
|
||||
onFocus={(e) => setIsFocused(e.target.matches(":focus-visible"))}
|
||||
onBlur={(e) => {
|
||||
if (!e.currentTarget.contains(e.relatedTarget)) setIsFocused(false);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="relative overflow-hidden rounded-2xl border border-neutral-800 bg-elevated/40 px-6 pb-5 pt-6 sm:px-8">
|
||||
{/* Every slide sits in the same grid cell, so the card is always as tall
|
||||
as the longest testimonial and nothing below it jumps on rotation. */}
|
||||
<div className="grid">
|
||||
{items.map((item, i) => (
|
||||
<figure
|
||||
key={item.name}
|
||||
aria-hidden={i !== current}
|
||||
className={`col-start-1 row-start-1 flex flex-col justify-between gap-6 transition-opacity duration-300 ${
|
||||
i === current ? "opacity-100" : "invisible opacity-0"
|
||||
}`}
|
||||
>
|
||||
{i === activeIndex ? <IconPointFilled /> : <IconPoint />}
|
||||
</button>
|
||||
<blockquote className="text-[19px] leading-[1.65] text-neutral-200">
|
||||
<span
|
||||
className="mr-0.5 font-serif text-[26px] leading-none"
|
||||
style={{ color: colors.accent }}
|
||||
>
|
||||
“
|
||||
</span>
|
||||
{item.quote}
|
||||
<span
|
||||
className="ml-0.5 font-serif text-[26px] leading-none"
|
||||
style={{ color: colors.accent }}
|
||||
>
|
||||
”
|
||||
</span>
|
||||
</blockquote>
|
||||
|
||||
<figcaption className="flex items-center gap-3">
|
||||
{item.avatar ? (
|
||||
<Image
|
||||
src={item.avatar}
|
||||
alt=""
|
||||
width={80}
|
||||
height={80}
|
||||
className="size-10 shrink-0 rounded-full border object-cover"
|
||||
style={{ borderColor: colors.accent }}
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
aria-hidden
|
||||
className="flex size-10 shrink-0 items-center justify-center rounded-full border bg-neutral-900 text-[12px] font-medium tracking-wide text-neutral-400"
|
||||
style={{ borderColor: colors.accent }}
|
||||
>
|
||||
{getInitials(item.name)}
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-0.5">
|
||||
<div className="text-base font-semibold text-neutral-100">{item.name}</div>
|
||||
<div className="text-sm text-neutral-400">{item.title}</div>
|
||||
</div>
|
||||
</figcaption>
|
||||
</figure>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* TODO: play/pause button + auto-rotate timer */}
|
||||
<button onClick={() => setIsPlaying(!isPlaying)} aria-label={isPlaying ? "Pause" : "Play"}>
|
||||
{isPlaying ? <IconPlayerPauseFilled size={20} /> : <IconPlayerPlayFilled size={20} />}
|
||||
</button>
|
||||
</footer>
|
||||
{items.length > 1 && (
|
||||
<footer className="relative mt-5 flex items-center justify-between border-t border-neutral-800 pt-3">
|
||||
{/* Countdown line, and also the rotation timer: when the shrink animation
|
||||
ends, the next testimonial shows. Re-keying on the slide restarts it
|
||||
from full, and pausing freezes it in place, so the line always
|
||||
matches the time actually left. */}
|
||||
<div
|
||||
key={current}
|
||||
aria-hidden
|
||||
className="animate-testimonial-countdown absolute inset-x-0 top-0 h-px origin-left"
|
||||
style={
|
||||
{
|
||||
"--countdown-ms": `${ROTATE_MS}ms`,
|
||||
backgroundColor: colors.accent,
|
||||
animationPlayState: shouldRotate ? "running" : "paused",
|
||||
} as React.CSSProperties
|
||||
}
|
||||
onAnimationEnd={() => setActiveIndex((i) => (i + 1) % items.length)}
|
||||
/>
|
||||
|
||||
<div className="flex">
|
||||
{items.map((item, i) => (
|
||||
<button
|
||||
key={item.name}
|
||||
type="button"
|
||||
onClick={() => setActiveIndex(i)}
|
||||
aria-label={`Show testimonial from ${item.name}`}
|
||||
aria-current={i === current}
|
||||
className={i === current ? "text-accent" : "text-neutral-600 transition-colors hover:text-neutral-400"}
|
||||
>
|
||||
{i === current ? <IconPointFilled /> : <IconPoint />}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsPlaying((p) => !p)}
|
||||
aria-label={isPlaying ? "Pause rotation" : "Resume rotation"}
|
||||
className="text-neutral-500 transition-colors hover:text-neutral-300"
|
||||
>
|
||||
{isPlaying ? <IconPlayerPauseFilled size={18} /> : <IconPlayerPlayFilled size={18} />}
|
||||
</button>
|
||||
</footer>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user