Files
Kaname/src/components/copy-button.tsx
T
Pascal LinxweilerandClaude Opus 5.5 1527fcd830 Hugging Face style model pages at /<org>/<name>
- Model URLs are the repo path (case-insensitive, canonical redirect);
  /models/<id> redirects
- Header with avatar, org/name + copy, task/format/arch/language/license
  pills, user tags, cross-links to the Hub (files @ sha, commits, community,
  base model) and tabs: rendered model card at the pinned commit, files, jobs
- Sidebar: download card, local copy, model tree with related local models
- Metadata gains author avatar and base relation (refetched once)
- Proxy matcher excludes only exact /login and /api/auth/ paths

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 20:12:39 +02:00

25 lines
638 B
TypeScript

"use client";
import { CheckIcon, CopyIcon } from "lucide-react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
export function CopyButton({ value, label = "Copy" }: { value: string; label?: string }) {
const [copied, setCopied] = useState(false);
return (
<Button
variant="ghost"
size="icon-xs"
aria-label={label}
title={label}
onClick={async () => {
await navigator.clipboard.writeText(value);
setCopied(true);
setTimeout(() => setCopied(false), 1500);
}}
>
{copied ? <CheckIcon /> : <CopyIcon />}
</Button>
);
}