export function copyLink() {
    let buttons = document.querySelectorAll('.copy-link button');
    buttons.forEach(function (button, index) {
        let input = button.parentNode.querySelector("input");
        let link = input.value;

        button.addEventListener('click', function() {
            navigator.clipboard.writeText(link).then(() => {
                input.value = 'Lien copié !';
                input.classList.add('is-copied');
                setTimeout(() => {
                    input.value = link;
                    input.classList.remove('is-copied');
                }, 1000);
            }).catch(err => {
                console.error('Erreur lors de la copie:', err);
            });
        });
    });
}

