|
|
| class PlayerSelector extends HTMLElement { |
| connectedCallback() { |
| this.attachShadow({ mode: 'open' }); |
| this.shadowRoot.innerHTML = ` |
| <style> |
| :host { |
| display: inline-block; |
| } |
| select { |
| border: 1px solid #e2e8f0; |
| border-radius: 12px; |
| padding: 12px 16px; |
| font-size: 14px; |
| color: #1e293b; |
| background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%); |
| transition: all 0.3s ease; |
| cursor: pointer; |
| min-width: 200px; |
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); |
| backdrop-filter: blur(10px); |
| } |
| select:focus { |
| outline: none; |
| border-color: #3b82f6; |
| box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); |
| transform: translateY(-1px); |
| } |
| select:hover { |
| border-color: #3b82f6; |
| transform: translateY(-1px); |
| } |
| label { |
| color: #64748b; |
| font-size: 14px; |
| font-weight: 500; |
| margin-right: 12px; |
| } |
| .selector-container { |
| display: flex; |
| align-items: center; |
| } |
| .pro-badge { |
| background: linear-gradient(135deg, #f59e0b, #d97706); |
| color: white; |
| font-size: 10px; |
| padding: 2px 8px; |
| border-radius: 8px; |
| margin-left: 8px; |
| font-weight: 600; |
| } |
| </style> |
| <div class="selector-container"> |
| <label for="player-select">Compare Players:</label> |
| <select id="player-select"> |
| <option value="top-scorer">⚽ Top Scorer</option> |
| <option value="top-assists">🎯 Top Assists</option> |
| <option value="top-passer">🔗 Top Passer</option> |
| <option value="top-defender">🛡️ Top Defender</option> |
| <option value="top-creator">🎨 Top Creator</option> |
| <option value="top-goalkeeper">🧤 Top Goalkeeper</option> |
| </select> |
| <span class="pro-badge">PRO</span> |
| </div> |
| `; |
| this.shadowRoot.querySelector('select').addEventListener('change', (e) => { |
| this.dispatchEvent(new CustomEvent('playerChange', { |
| detail: { selection: e.target.value }, |
| bubbles: true |
| })); |
| }); |
| } |
| } |
|
|
| customElements.define('player-selector', PlayerSelector); |
|
|