Skip to content

Commit

Permalink
feature: adding copied notice
Browse files Browse the repository at this point in the history
  • Loading branch information
paganotoni committed Jun 14, 2024
1 parent ae52bb4 commit a5153fe
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions internal/assets/doco.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,13 @@ let doco = {
bt.addEventListener("click", () => {
navigator.clipboard.writeText(el.textContent);

// Add a notice that the code was copied
let notice = document.createElement("div");
notice.appendChild(document.createTextNode("Copied!"));
notice.classList.add(
"absolute",
"top-3",
"right-2",
"p-2",
"bg-gray-50",
"rounded",
"text-sm",
)

notice.classList.add("absolute","top-3","right-2","p-2","bg-gray-50","rounded","text-sm");
el.appendChild(notice);

// Remove the notice after 1.5 seconds
setTimeout(() => {
notice.remove()
}, 1500);
Expand Down

0 comments on commit a5153fe

Please sign in to comment.