Spaces:
Running
Running
File size: 4,961 Bytes
a8624fc | 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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | class CourseFilter extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.filter-controls {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
margin-bottom: 2rem;
justify-content: center;
}
.filter-btn {
padding: 0.5rem 1.25rem;
border-radius: 9999px;
border: 1px solid rgba(255, 255, 255, 0.2);
background: transparent;
color: rgba(255, 255, 255, 0.8);
cursor: pointer;
transition: all 0.3s ease;
}
.filter-btn:hover, .filter-btn.active {
background: linear-gradient(90deg, #4f46e5, #ec4899);
color: white;
border-color: transparent;
}
.courses-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 1.5rem;
}
.course-card {
background: rgba(30, 41, 59, 0.7);
border-radius: 16px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.1);
transition: all 0.3s ease;
}
.course-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
.course-image {
width: 100%;
height: 160px;
object-fit: cover;
}
.course-content {
padding: 1.5rem;
}
.course-category {
display: inline-block;
padding: 0.25rem 0.75rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 600;
margin-bottom: 0.75rem;
}
.web-dev {
background: rgba(79, 70, 229, 0.2);
color: #4f46e5;
}
.ai {
background: rgba(236, 72, 153, 0.2);
color: #ec4899;
}
.python {
background: rgba(16, 185, 129, 0.2);
color: #10b981;
}
.mobile {
background: rgba(245, 158, 11, 0.2);
color: #f59e0b;
}
.course-title {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: 0.5rem;
color: white;
}
.course-desc {
color: rgba(255, 255, 255, 0.7);
font-size: 0.875rem;
margin-bottom: 1rem;
line-height: 1.5;
}
.course-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.course-price {
font-weight: 700;
color: white;
}
.course-duration {
display: flex;
align-items: center;
gap: 0.25rem;
font-size: 0.875rem;
color: rgba(255, 255, 255, 0.7);
}
.course-duration i {
width: 14px;
height: 14px;
}
.no-courses {
grid-column: 1 / -1;
text-align: center;
padding: 2rem;
color: rgba(255, 255, 255, 0.7);
}
</style>
<div class="filter-controls">
<button class="filter-btn active" data-filter="all">All Courses</button>
<button class="filter-btn" data-filter="web">Web Development</button>
<button class="filter-btn" data-filter="ai">AI & Machine Learning</button>
<button class="filter-btn" data-filter="python">Python</button>
<button class="filter-btn" data-filter="mobile">Mobile Development</button>
</ |