55 <nav
66 class =" max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between"
77 >
8- <div class =" flex-shrink-0" >
9- <h1
10- class =" text-lg sm:text-xl font-bold text-blue-600 dark:text-blue-400 leading-tight"
11- >
12- CREATOR
13- </h1 >
14- <p
15- class =" text-[10px] sm:text-xs text-gray-600 dark:text-gray-400 leading-tight"
16- >
17- didaCtic and geneRic assEmbly progrAmming simulaTOR
18- </p >
8+ <div class =" flex-shrink-0 flex items-center gap-3" >
9+ <a href =" #" >
10+ <img
11+ src =" /images/creator_small.webp"
12+ alt =" Creator Simulator Logo"
13+ class =" h-10 w-auto transition-transform hover:scale-105"
14+ />
15+ </a >
16+
17+ <div class =" hidden sm:block" > <h1 class =" text-lg sm:text-xl font-bold text-blue-600 dark:text-blue-400 leading-tight" >
18+ CREATOR
19+ </h1 >
20+ <p class =" text-[10px] sm:text-xs text-gray-600 dark:text-gray-400 leading-tight" >
21+ didactic and generic assembly programming simulator
22+ </p >
23+ </div >
1924 </div >
2025
2126 <!-- Desktop Navigation -->
2227 <ul class =" hidden md:flex items-center gap-3 lg:gap-6 text-sm" >
2328 <li >
2429 <a
2530 href =" #about"
26- class =" font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
31+ :class =" isActive('about') ? 'text-blue-600 dark:text-blue-400' : 'text-gray-700 dark:text-gray-300'"
32+ class =" font-medium hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
2733 >About</a
2834 >
2935 </li >
3036 <li >
3137 <a
3238 href =" #publications"
33- class =" font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
39+ :class =" isActive('publications') ? 'text-blue-600 dark:text-blue-400' : 'text-gray-700 dark:text-gray-300'"
40+ class =" font-medium hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
3441 >Publications</a
3542 >
3643 </li >
3744 <li >
3845 <a
3946 href =" #evolution"
40- class =" font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
47+ :class =" isActive('evolution') ? 'text-blue-600 dark:text-blue-400' : 'text-gray-700 dark:text-gray-300'"
48+ class =" font-medium hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
4149 >Evolution</a
4250 >
4351 </li >
4452 <li >
4553 <a
4654 href =" #authors"
47- class =" font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
55+ :class =" isActive('authors') ? 'text-blue-600 dark:text-blue-400' : 'text-gray-700 dark:text-gray-300'"
56+ class =" font-medium hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
4857 >Authors</a
4958 >
5059 </li >
5160 <li >
5261 <a
5362 href =" #contributors"
54- class =" font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
63+ :class =" isActive('contributors') ? 'text-blue-600 dark:text-blue-400' : 'text-gray-700 dark:text-gray-300'"
64+ class =" font-medium hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
5565 >Contributors</a
5666 >
5767 </li >
146156 <a
147157 href =" #about"
148158 @click =" closeMobileMenu"
149- class =" block px-3 py-2 text-base font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
159+ :class =" isActive('about') ? 'text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-gray-800' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800'"
160+ class =" block px-3 py-2 text-base font-medium hover:text-blue-600 dark:hover:text-blue-400 rounded-md"
150161 >About</a
151162 >
152163 <a
153164 href =" #publications"
154165 @click =" closeMobileMenu"
155- class =" block px-3 py-2 text-base font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
166+ :class =" isActive('publications') ? 'text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-gray-800' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800'"
167+ class =" block px-3 py-2 text-base font-medium hover:text-blue-600 dark:hover:text-blue-400 rounded-md"
156168 >Publications</a
157169 >
158170 <a
159171 href =" #evolution"
160172 @click =" closeMobileMenu"
161- class =" block px-3 py-2 text-base font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
173+ :class =" isActive('evolution') ? 'text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-gray-800' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800'"
174+ class =" block px-3 py-2 text-base font-medium hover:text-blue-600 dark:hover:text-blue-400 rounded-md"
162175 >Evolution</a
163176 >
164177 <a
165178 href =" #authors"
166179 @click =" closeMobileMenu"
167- class =" block px-3 py-2 text-base font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
180+ :class =" isActive('authors') ? 'text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-gray-800' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800'"
181+ class =" block px-3 py-2 text-base font-medium hover:text-blue-600 dark:hover:text-blue-400 rounded-md"
168182 >Authors</a
169183 >
170184 <a
171185 href =" #contributors"
172186 @click =" closeMobileMenu"
173- class =" block px-3 py-2 text-base font-medium text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
187+ :class =" isActive('contributors') ? 'text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-gray-800' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800'"
188+ class =" block px-3 py-2 text-base font-medium hover:text-blue-600 dark:hover:text-blue-400 rounded-md"
174189 >Contributors</a
175190 >
176191 <button
@@ -233,13 +248,23 @@ export default {
233248 data () {
234249 return {
235250 isMobileMenuOpen: false ,
251+ activeSection: ' ' ,
252+ observer: null ,
236253 }
237254 },
238255 mounted () {
239256 // Init smooth scroll
240257 this .initSmoothScroll ()
258+ // Init scroll Spy
259+ this .initScrollSpy ()
260+ },
261+ beforeUnmount () {
262+ if (this .observer ) this .observer .disconnect ();
241263 },
242264 methods: {
265+ isActive (section ) {
266+ return this .activeSection === section;
267+ },
243268 toggleDarkMode () {
244269 this .$emit (" toggle-dark-mode" )
245270 },
@@ -249,14 +274,40 @@ export default {
249274 closeMobileMenu () {
250275 this .isMobileMenuOpen = false
251276 },
277+ initScrollSpy () {
278+ const sections = document .querySelectorAll (' section' );
279+
280+ const options = {
281+ root: null ,
282+ rootMargin: ' -45% 0px -45% 0px' ,
283+ threshold: 0
284+ };
285+
286+ this .observer = new IntersectionObserver ((entries ) => {
287+ entries .forEach ((entry ) => {
288+ if (entry .isIntersecting ) {
289+ this .activeSection = entry .target .id ;
290+ }
291+ });
292+ }, options);
293+
294+ sections .forEach ((section ) => {
295+ this .observer .observe (section);
296+ });
297+ },
252298 initSmoothScroll () {
299+ const self = this ;
300+
253301 document .querySelectorAll (' a[href^="#"]' ).forEach (anchor => {
254302 anchor .addEventListener (" click" , function (e ) {
255303 const href = this .getAttribute (" href" )
256304 if (href !== " #" && href .length > 1 ) {
257305 e .preventDefault ()
258306 const target = document .querySelector (href)
259307 if (target) {
308+ self .activeSection = href .substring (1 );
309+ self .closeMobileMenu ();
310+
260311 const headerOffset = 64
261312 const elementPosition = target .getBoundingClientRect ().top
262313 const offsetPosition =
0 commit comments