Files
portfolio/components/ui/CopyButton.tsx
T
donnyandClaude Opus 5.5 abd5fd4a58 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>
2026-11-24 18:16:13 -07:00

58 lines
1.4 KiB
TypeScript

"use client";
import { useState, type ReactNode } from "react";
type CopyButtonProps = {
value: string;
label: string;
copiedLabel?: string;
className?: string;
children: ReactNode;
};
export default function CopyButton({
value,
label,
copiedLabel = "Copied!",
className = "rounded-md p-1 text-neutral-600 transition-colors duration-200 hover:text-neutral-200 cursor-pointer",
children,
}: CopyButtonProps) {
const [copied, setCopied] = useState(false);
const handleCopy = async (e: React.MouseEvent<HTMLButtonElement>) => {
e.currentTarget.blur();
try {
await navigator.clipboard.writeText(value);
setCopied(true);
window.setTimeout(() => setCopied(false), 1500);
} catch {
// clipboard unavailable - silently ignore
}
};
return (
<span className="group relative inline-flex">
<button
type="button"
onClick={handleCopy}
aria-label={label}
className={className}
>
{children}
</button>
<span
role="tooltip"
className="
pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2
rounded-md bg-neutral-800 px-2 py-1 text-xs text-neutral-100
whitespace-nowrap opacity-0
transition-opacity duration-150
group-hover:opacity-100 group-focus-within:opacity-100
"
>
{copied ? copiedLabel : label}
</span>
</span>
);
}