Spaces:
Running
Running
| class LeetCodeStats extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| .leetcode-container { | |
| background: white; | |
| border-radius: 12px; | |
| padding: 1.5rem; | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| margin: 1rem 0; | |
| } | |
| .stats-header { | |
| display: flex; | |
| align-items: center; | |
| margin-bottom: 1rem; | |
| } | |
| .leetcode-logo { | |
| width: 32px; | |
| height: 32px; | |
| margin-right: 0.75rem; | |
| } | |
| .stats-grid { | |
| display: grid; | |
| grid-template-columns: repeat(2, 1fr); | |
| gap: 1rem; | |
| } | |
| .stat-item { | |
| background: #f8fafc; | |
| padding: 0.75rem; | |
| border-radius: 8px; | |
| } | |
| .stat-label { | |
| font-size: 0.875rem; | |
| color: #64748b; | |
| margin-bottom: 0.25rem; | |
| } | |
| .stat-value { | |
| font-weight: 600; | |
| color: #1e293b; | |
| } | |
| .difficulty-bar { | |
| height: 8px; | |
| border-radius: 4px; | |
| margin-top: 0.5rem; | |
| background: #e2e8f0; | |
| overflow: hidden; | |
| } | |
| .difficulty-fill { | |
| height: 100%; | |
| } | |
| .easy { background: #10b981; width: 70%; } | |
| .medium { background: #f59e0b; width: 25%; } | |
| .hard { background: #ef4444; width: 5%; } | |
| </style> | |
| <div class="leetcode-container"> | |
| <div class="stats-header"> | |
| <img src="https://leetcode.com/static/images/LeetCode_logo_rvs.png" alt="LeetCode" class="leetcode-logo"> | |
| <h3 class="text-xl font-bold">LeetCode Stats</h3> | |
| </div> | |
| <div class="stats-grid"> | |
| <div class="stat-item"> | |
| <div class="stat-label">Problems Solved</div> | |
| <div class="stat-value">500+</div> | |
| </div> | |
| <div class="stat-item"> | |
| <div class="stat-label">Global Ranking</div> | |
| <div class="stat-value">Top 5%</div> | |
| </div> | |
| <div class="stat-item"> | |
| <div class="stat-label">Contest Rating</div> | |
| <div class="stat-value">1867</div> | |
| </div> | |
| <div class="stat-item"> | |
| <div class="stat-label">Acceptance Rate</div> | |
| <div class="stat-value">82%</div> | |
| </div> | |
| </div> | |
| <div class="mt-4"> | |
| <div class="flex justify-between text-sm mb-1"> | |
| <span>Difficulty Breakdown</span> | |
| <span>500 Total</span> | |
| </div> | |
| <div class="difficulty-bar"> | |
| <div class="difficulty-fill easy"></div> | |
| <div class="difficulty-fill medium"></div> | |
| <div class="difficulty-fill hard"></div> | |
| </div> | |
| <div class="flex justify-between text-xs mt-1"> | |
| <span>350 Easy</span> | |
| <span>125 Medium</span> | |
| <span>25 Hard</span> | |
| </div> | |
| </div> | |
| </div> | |
| `; | |
| } | |
| } | |
| customElements.define('leetcode-stats', LeetCodeStats); |