copia e cola no código PIX gerado

Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2026-02-21 15:27:19 -03:00
1 parent 38a8b1b614
commit e0689e90dd
1 file changed
+41 -3
+41 -3
View File
@@ -373,6 +373,35 @@
color: #333; color: #333;
transform: translateY(-10px); transform: translateY(-10px);
opacity: 0; opacity: 0;
cursor: pointer;
transition: all 0.2s ease;
border: 2px solid transparent;
position: relative;
}
.pix-code-area::before {
content: '👆 Clique para copiar';
position: absolute;
top: -8px;
right: 10px;
background: #32BCAD;
color: white;
padding: 4px 10px;
border-radius: 12px;
font-size: 0.75em;
font-family: 'Segoe UI', sans-serif;
opacity: 0;
transition: opacity 0.3s ease;
}
.pix-code-area.active::before {
opacity: 1;
}
.pix-code-area:hover {
background: #e8f5f3;
border-color: #32BCAD;
transform: scale(1.02);
} }
.pix-code-area.active { .pix-code-area.active {
@@ -641,10 +670,16 @@
const pixCode = buildPixCode(pixKey, merchantName, city, formattedValue, txid); const pixCode = buildPixCode(pixKey, merchantName, city, formattedValue, txid);
// Exibe o código // Exibe o código
document.getElementById('pixCodeArea').textContent = pixCode; const pixCodeArea = document.getElementById('pixCodeArea');
document.getElementById('pixCodeArea').classList.add('active'); pixCodeArea.textContent = pixCode;
pixCodeArea.classList.add('active');
// Copia automaticamente // Adiciona evento de clique para copiar
pixCodeArea.onclick = function() {
copyToClipboard(pixCode);
};
// Copia automaticamente na primeira vez
copyToClipboard(pixCode); copyToClipboard(pixCode);
} }
@@ -724,7 +759,10 @@
function showCopyNotification() { function showCopyNotification() {
const notification = document.getElementById('copyNotification'); const notification = document.getElementById('copyNotification');
notification.classList.remove('active'); // Remove primeiro para reiniciar animação
setTimeout(() => {
notification.classList.add('active'); notification.classList.add('active');
}, 10);
setTimeout(() => { setTimeout(() => {
notification.classList.remove('active'); notification.classList.remove('active');
}, 3000); }, 3000);