Spaces:
Sleeping
Sleeping
Enhance CSS transitions and animations for course components, improving visual effects during toggling. Introduce closing animations for inactive courses and staggered appearance for notebooks to enhance user experience.
Browse files- scripts/build.py +61 -24
scripts/build.py
CHANGED
@@ -404,7 +404,7 @@ def generate_eva_css() -> str:
|
|
404 |
background-color: var(--eva-terminal-bg);
|
405 |
border: 1px solid var(--eva-purple);
|
406 |
border-radius: var(--eva-border-radius);
|
407 |
-
transition: var(--eva-transition);
|
408 |
position: relative;
|
409 |
overflow: hidden;
|
410 |
height: 350px;
|
@@ -498,7 +498,7 @@ def generate_eva_css() -> str:
|
|
498 |
.eva-course-toggle {
|
499 |
color: var(--eva-purple);
|
500 |
font-size: 1.5rem;
|
501 |
-
transition: transform 0.
|
502 |
}
|
503 |
|
504 |
.eva-course.active .eva-course-toggle {
|
@@ -575,6 +575,8 @@ def generate_eva_css() -> str:
|
|
575 |
.eva-course.active {
|
576 |
height: auto;
|
577 |
min-height: 350px;
|
|
|
|
|
578 |
}
|
579 |
|
580 |
.eva-notebooks {
|
@@ -588,11 +590,13 @@ def generate_eva_css() -> str:
|
|
588 |
margin-bottom: 0.5rem;
|
589 |
padding: 0.75rem;
|
590 |
border-left: 2px solid var(--eva-blue);
|
591 |
-
transition:
|
592 |
display: flex;
|
593 |
align-items: center;
|
594 |
background-color: rgba(0, 0, 0, 0.2);
|
595 |
border-radius: 0 var(--eva-border-radius) var(--eva-border-radius) 0;
|
|
|
|
|
596 |
}
|
597 |
|
598 |
[data-theme="light"] .eva-notebook {
|
@@ -857,6 +861,18 @@ def generate_eva_css() -> str:
|
|
857 |
grid-template-columns: 1fr;
|
858 |
}
|
859 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
860 |
"""
|
861 |
|
862 |
|
@@ -1177,31 +1193,52 @@ def generate_index(courses: Dict[str, Dict[str, Any]], output_dir: str) -> None:
|
|
1177 |
function toggleCourse(course) {
|
1178 |
const isActive = course.classList.contains('active');
|
1179 |
|
1180 |
-
// First close all courses
|
1181 |
-
document.querySelectorAll('.eva-course').forEach(c => {
|
1182 |
-
c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1183 |
});
|
1184 |
|
1185 |
// Toggle the clicked course
|
1186 |
if (!isActive) {
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1205 |
}
|
1206 |
}
|
1207 |
|
|
|
404 |
background-color: var(--eva-terminal-bg);
|
405 |
border: 1px solid var(--eva-purple);
|
406 |
border-radius: var(--eva-border-radius);
|
407 |
+
transition: var(--eva-transition), height 0.4s cubic-bezier(0.19, 1, 0.22, 1);
|
408 |
position: relative;
|
409 |
overflow: hidden;
|
410 |
height: 350px;
|
|
|
498 |
.eva-course-toggle {
|
499 |
color: var(--eva-purple);
|
500 |
font-size: 1.5rem;
|
501 |
+
transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
|
502 |
}
|
503 |
|
504 |
.eva-course.active .eva-course-toggle {
|
|
|
575 |
.eva-course.active {
|
576 |
height: auto;
|
577 |
min-height: 350px;
|
578 |
+
max-height: 800px;
|
579 |
+
transition: height 0.4s cubic-bezier(0.19, 1, 0.22, 1), transform 0.3s ease, box-shadow 0.3s ease;
|
580 |
}
|
581 |
|
582 |
.eva-notebooks {
|
|
|
590 |
margin-bottom: 0.5rem;
|
591 |
padding: 0.75rem;
|
592 |
border-left: 2px solid var(--eva-blue);
|
593 |
+
transition: all 0.25s ease;
|
594 |
display: flex;
|
595 |
align-items: center;
|
596 |
background-color: rgba(0, 0, 0, 0.2);
|
597 |
border-radius: 0 var(--eva-border-radius) var(--eva-border-radius) 0;
|
598 |
+
opacity: 1;
|
599 |
+
transform: translateX(0);
|
600 |
}
|
601 |
|
602 |
[data-theme="light"] .eva-notebook {
|
|
|
861 |
grid-template-columns: 1fr;
|
862 |
}
|
863 |
}
|
864 |
+
|
865 |
+
.eva-course.closing .eva-course-content {
|
866 |
+
opacity: 0;
|
867 |
+
transform: translateY(10px);
|
868 |
+
transition: opacity 0.2s ease, transform 0.2s ease;
|
869 |
+
}
|
870 |
+
|
871 |
+
.eva-course.closing .eva-course-front {
|
872 |
+
opacity: 1;
|
873 |
+
transform: translateY(0);
|
874 |
+
transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
|
875 |
+
}
|
876 |
"""
|
877 |
|
878 |
|
|
|
1193 |
function toggleCourse(course) {
|
1194 |
const isActive = course.classList.contains('active');
|
1195 |
|
1196 |
+
// First close all courses with a slight delay for better visual effect
|
1197 |
+
document.querySelectorAll('.eva-course.active').forEach(c => {
|
1198 |
+
if (c !== course) {
|
1199 |
+
// Add a closing class for animation
|
1200 |
+
c.classList.add('closing');
|
1201 |
+
// Remove active class after a short delay
|
1202 |
+
setTimeout(() => {
|
1203 |
+
c.classList.remove('active');
|
1204 |
+
c.classList.remove('closing');
|
1205 |
+
}, 300);
|
1206 |
+
}
|
1207 |
});
|
1208 |
|
1209 |
// Toggle the clicked course
|
1210 |
if (!isActive) {
|
1211 |
+
// Add a small delay before opening to allow others to close
|
1212 |
+
setTimeout(() => {
|
1213 |
+
course.classList.add('active');
|
1214 |
+
|
1215 |
+
// Check if the course has any notebooks
|
1216 |
+
const notebooks = course.querySelectorAll('.eva-notebook');
|
1217 |
+
const content = course.querySelector('.eva-course-content');
|
1218 |
+
|
1219 |
+
if (notebooks.length === 0 && !content.querySelector('.eva-empty-message')) {
|
1220 |
+
// If no notebooks, show a message
|
1221 |
+
const emptyMessage = document.createElement('p');
|
1222 |
+
emptyMessage.className = 'eva-empty-message';
|
1223 |
+
emptyMessage.textContent = 'No notebooks available in this course yet.';
|
1224 |
+
emptyMessage.style.color = 'var(--eva-text)';
|
1225 |
+
emptyMessage.style.fontStyle = 'italic';
|
1226 |
+
emptyMessage.style.opacity = '0.7';
|
1227 |
+
emptyMessage.style.textAlign = 'center';
|
1228 |
+
emptyMessage.style.padding = '1rem 0';
|
1229 |
+
content.appendChild(emptyMessage);
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
// Animate notebooks to appear sequentially
|
1233 |
+
notebooks.forEach((notebook, index) => {
|
1234 |
+
notebook.style.opacity = '0';
|
1235 |
+
notebook.style.transform = 'translateX(-10px)';
|
1236 |
+
setTimeout(() => {
|
1237 |
+
notebook.style.opacity = '1';
|
1238 |
+
notebook.style.transform = 'translateX(0)';
|
1239 |
+
}, 50 + (index * 30)); // Stagger the animations
|
1240 |
+
});
|
1241 |
+
}, 100);
|
1242 |
}
|
1243 |
}
|
1244 |
|