Files
wehub-resource-sync 979fb22d7c
CI / test (20, macos-latest) (push) Waiting to run
CI / test (20, ubuntu-latest) (push) Waiting to run
CI / test (22, macos-latest) (push) Waiting to run
CI / test (22, ubuntu-latest) (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:01:18 +08:00

34 lines
850 B
TypeScript

"use client";
import { useState } from "react";
import styles from "./HeroNpxCommand.module.css";
const CMD = "npx @agentmemory/agentmemory";
export function HeroNpxCommand() {
const [copied, setCopied] = useState(false);
const onCopy = async () => {
try {
await navigator.clipboard.writeText(CMD);
setCopied(true);
window.setTimeout(() => setCopied(false), 1600);
} catch {
/* clipboard blocked — keep button visible */
}
};
return (
<button
type="button"
onClick={onCopy}
className={`${styles.cmd} ${copied ? styles.copied : ""}`}
aria-label="Copy install command"
>
<span className={styles.prompt}>$</span>
<span className={styles.text}>{CMD}</span>
<span className={styles.hint}>{copied ? "COPIED" : "CLICK TO COPY"}</span>
</button>
);
}