Spaces:
Running
Running
File size: 3,089 Bytes
decb1ad | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | 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); |