11import { Component , OnInit } from '@angular/core' ;
2+ import { CommonModule } from '@angular/common' ;
23import { NavbarComponent } from "../../components/navbar/navbar.component" ;
34import { CategoriesComponent } from "../../components/categories/categories.component" ;
45import { AboutComponent } from "../../components/about/about.component" ;
@@ -9,16 +10,18 @@ import { ContactformComponent } from "../../components/contactform/contactform.c
910import { FooterComponent } from "../../components/footer/footer.component" ;
1011import { SearchFormComponent } from "../../components/search-form/search-form.component" ;
1112import { Router } from '@angular/router' ;
13+ import { IRoutes } from '../../interfaces/interface' ;
1214
1315@Component ( {
1416 selector : 'app-landing' ,
1517 standalone : true ,
16- imports : [ NavbarComponent , CategoriesComponent , AboutComponent , EventsComponent , EventComponent , ButtonComponent , ContactformComponent , FooterComponent , SearchFormComponent ] ,
18+ imports : [ CommonModule , NavbarComponent , CategoriesComponent , AboutComponent , EventsComponent , EventComponent , ButtonComponent , ContactformComponent , FooterComponent , SearchFormComponent ] ,
1719 templateUrl : './landing.component.html' ,
1820 styleUrl : './landing.component.scss'
1921} )
2022export class LandingComponent implements OnInit {
21-
23+ whiteColor : string = '#fff'
24+ deepBlue : string = '#fff'
2225 constructor ( private router : Router ) { }
2326 ngOnInit ( ) : void {
2427 if ( typeof window !== "undefined" ) {
@@ -28,6 +31,18 @@ export class LandingComponent implements OnInit {
2831 }
2932 }
3033 }
31- whiteColor : string = '#fff'
32- deepBlue : string = '#fff'
34+
35+ handleClickedNavItem ( event : IRoutes ) {
36+ console . log ( 'Navigating to:' , event ) ;
37+ const element = document . getElementById ( event . name . toLocaleLowerCase ( ) ) ;
38+ if ( ! element ) {
39+ console . warn ( 'Section not found:' , event . name ) ;
40+ return ;
41+ }
42+
43+ element . scrollIntoView ( {
44+ behavior : 'smooth' ,
45+ block : 'start'
46+ } ) ;
47+ }
3348}
0 commit comments