Fix copy buttons: swap to standard copy icon, fix docs copy visibility, DOMContentLoaded guard
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -57,28 +57,8 @@ const terminalCommands = [
|
||||
class="group flex items-center gap-3 rounded-lg bg-muted px-4 py-2.5 font-mono text-sm transition-colors hover:bg-muted/80 cursor-pointer"
|
||||
>
|
||||
<span>curl -fsSL https://feynman.is/install | bash</span>
|
||||
<svg
|
||||
id="copy-icon"
|
||||
class="size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="2"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9.75a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184" />
|
||||
</svg>
|
||||
<svg
|
||||
id="check-icon"
|
||||
class="hidden size-4 shrink-0 text-primary"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="2"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
|
||||
</svg>
|
||||
<svg id="copy-icon" class="size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
|
||||
<svg id="check-icon" class="hidden size-4 shrink-0 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path d="M20 6L9 17l-5-5"/></svg>
|
||||
</button>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
@@ -217,16 +197,19 @@ const terminalCommands = [
|
||||
</Layout>
|
||||
|
||||
<script is:inline>
|
||||
document.getElementById("install-cmd").addEventListener("click", function () {
|
||||
navigator.clipboard.writeText("curl -fsSL https://feynman.is/install | bash").then(function () {
|
||||
var copyIcon = document.getElementById("copy-icon")
|
||||
var checkIcon = document.getElementById("check-icon")
|
||||
copyIcon.classList.add("hidden")
|
||||
checkIcon.classList.remove("hidden")
|
||||
setTimeout(function () {
|
||||
copyIcon.classList.remove("hidden")
|
||||
checkIcon.classList.add("hidden")
|
||||
}, 2000)
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var btn = document.getElementById("install-cmd")
|
||||
if (btn) btn.addEventListener("click", function () {
|
||||
navigator.clipboard.writeText("curl -fsSL https://feynman.is/install | bash").then(function () {
|
||||
var copyIcon = document.getElementById("copy-icon")
|
||||
var checkIcon = document.getElementById("check-icon")
|
||||
copyIcon.classList.add("hidden")
|
||||
checkIcon.classList.remove("hidden")
|
||||
setTimeout(function () {
|
||||
copyIcon.classList.remove("hidden")
|
||||
checkIcon.classList.add("hidden")
|
||||
}, 2000)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -210,10 +210,10 @@
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0.25rem;
|
||||
color: var(--muted-foreground);
|
||||
background: var(--muted);
|
||||
background: var(--background);
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s, color 0.15s;
|
||||
cursor: pointer;
|
||||
|
||||
Reference in New Issue
Block a user