Plugin Directory

Changeset 3446019


Ignore:
Timestamp:
01/24/2026 08:58:53 AM (2 months ago)
Author:
madnesscode1
Message:

fix color button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • madnesschat-button/tags/1.0.2/assets/js/mcnb-frontend-simple.js

    r3411134 r3446019  
    197197                offsetX: cfg.offsetX || 20,
    198198                offsetY: cfg.offsetY || 20,
    199                 showLabel: cfg.showLabel
     199                showLabel: cfg.showLabel,
     200                // Usar siempre el color de fondo configurado
     201                brandColor: cfg.brandColor || '#25D366'
    200202            };
    201203        }
     
    312314            // Aplicar estilos básicos
    313315            var size = currentConfig.size;
    314             btn.style.width = size + 'px';
    315             btn.style.height = size + 'px';
    316316            btn.style.background = currentConfig.brandColor || '#25D366';
    317317            btn.style.color = cfg.textColor || '#ffffff';
     318            btn.style.boxSizing = 'border-box';
    318319            btn.style.borderRadius = '50%';
    319320            btn.style.display = 'flex';
     
    326327            // Aplicar estilo de botón si está configurado
    327328            if (cfg.buttonStyle === 'square') {
     329                btn.style.width = size + 'px';
     330                btn.style.height = size + 'px';
    328331                btn.style.borderRadius = '8px';
    329332            } else if (cfg.buttonStyle === 'pill') {
     333                // Permitir que el botón se estire horizontalmente
     334                btn.style.width = 'auto';
     335                btn.style.height = 'auto';
     336                btn.style.minWidth = size + 'px';
     337                btn.style.minHeight = size + 'px';
    330338                btn.style.borderRadius = '999px';
    331                 btn.style.padding = '0 16px';
     339                btn.style.padding = '0 ' + Math.round(size * 0.35) + 'px';
    332340            } else if (cfg.buttonStyle === 'text_side') {
     341                // Permitir texto al lado dentro del botón (ancho automático)
     342                btn.style.width = 'auto';
     343                btn.style.height = 'auto';
     344                btn.style.minWidth = size + 'px';
     345                btn.style.minHeight = size + 'px';
    333346                btn.style.borderRadius = '999px';
    334                 btn.style.padding = '12px 20px';
     347                btn.style.padding = Math.round(size * 0.22) + 'px ' + Math.round(size * 0.4) + 'px';
    335348                btn.style.gap = '8px';
     349            } else {
     350                // circle (default)
     351                btn.style.width = size + 'px';
     352                btn.style.height = size + 'px';
    336353            }
    337354
Note: See TracChangeset for help on using the changeset viewer.