copy link modal
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s

This commit is contained in:
Julie Blanc 2026-01-21 17:25:37 +01:00
parent 2f7473be0a
commit 43ad7241d4
10 changed files with 111 additions and 147 deletions

View file

@ -1,14 +1,16 @@
export function copyLink() {
let buttons = document.querySelectorAll('.copy-link button');
buttons.forEach(function (button, index) {
let link = button.parentNode.querySelector("input").value;
let input = button.parentNode.querySelector("input");
let link = input.value;
button.addEventListener('click', function() {
navigator.clipboard.writeText(link).then(() => {
const originalText = button.textContent;
button.textContent = 'Lien copié';
input.value = 'Lien copié !';
input.classList.add('is-copied');
setTimeout(() => {
button.textContent = originalText;
input.value = link;
input.classList.remove('is-copied');
}, 1000);
}).catch(err => {
console.error('Erreur lors de la copie:', err);