export default function handleShareButton() { const shareButton = document.querySelector('.socials-buttons__button--share'); if (!shareButton) return; shareButton.addEventListener('click', () => { const isOpen = shareButton.classList.contains('is-open'); if (!isOpen) { shareButton.classList.add('is-open'); } else { shareButton.classList.remove('is-open'); } }); handleCopyLinkButton(); } function handleCopyLinkButton() { const copyLinkButton = document.querySelector('.share-button--copy-link a'); if (!copyLinkButton) return; copyLinkButton.addEventListener('click', (e) => { e.preventDefault(); const url = copyLinkButton.getAttribute('data-url'); if (!url) return; navigator.clipboard.writeText(url); const notyf = new Notyf({ duration: 4000, ripple: false, dismissible: true, position: { x: 'right', y: 'top', }, }); notyf.success('Lien copiƩ !'); }); }