File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /* Intentionally blank */
Original file line number Diff line number Diff line change 1+ <!-- Dropdown for Desktop -->
2+ < div *ngIf ="displayMode === 'dropdown' " class ="relative language-switcher-container ">
3+ < button (click) ="toggleDropdown() " class ="flex items-center text-gray-700 hover:text-indigo-600 focus:outline-none transition-colors duration-200 " i18n-title title ="Select language ">
4+ < i class ="ph ph-globe ph-l "> </ i >
5+ </ button >
6+
7+ < div
8+ *ngIf ="isDropdownOpen "
9+ class ="absolute right-0 mt-2 w-40 bg-white rounded-md shadow-lg z-20 "
10+ >
11+ < div class ="py-1 ">
12+ < a href ="/ " class ="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-indigo-600 " (click) ="closeDropdown() ">
13+ 🇬🇧 English
14+ </ a >
15+ < a href ="/pt " class ="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-indigo-600 " (click) ="closeDropdown() ">
16+ 🇧🇷 Português
17+ </ a >
18+ </ div >
19+ </ div >
20+ </ div >
21+
22+ <!-- Inline for Mobile -->
23+ < div *ngIf ="displayMode === 'inline' " class ="w-full text-center py-2 ">
24+ < div class ="flex justify-center items-center space-x-4 ">
25+ < a href ="/ " class ="text-base font-medium text-gray-700 hover:text-indigo-600 "> English</ a >
26+ < span class ="text-gray-300 "> |</ span >
27+ < a href ="/pt " class ="text-base font-medium text-gray-700 hover:text-indigo-600 "> Português</ a >
28+ </ div >
29+ </ div >
Original file line number Diff line number Diff line change 1+ import { Component , HostListener , Input } from '@angular/core' ;
2+ import { CommonModule } from '@angular/common' ;
3+
4+ @Component ( {
5+ selector : 'app-language-switcher' ,
6+ standalone : true ,
7+ imports : [ CommonModule ] ,
8+ templateUrl : './language-switcher.html' ,
9+ styleUrl : './language-switcher.css'
10+ } )
11+ export class LanguageSwitcher {
12+ @Input ( ) displayMode : 'dropdown' | 'inline' = 'dropdown' ;
13+
14+ isDropdownOpen = false ;
15+
16+ toggleDropdown ( ) {
17+ this . isDropdownOpen = ! this . isDropdownOpen ;
18+ }
19+
20+ closeDropdown ( ) {
21+ this . isDropdownOpen = false ;
22+ }
23+
24+ @HostListener ( 'document:click' , [ '$event' ] )
25+ onDocumentClick ( event : MouseEvent ) {
26+ const target = event . target as HTMLElement ;
27+ if ( ! target . closest ( '.language-switcher-container' ) ) {
28+ this . closeDropdown ( ) ;
29+ }
30+ }
31+ }
Original file line number Diff line number Diff line change 77 </ a >
88
99 <!-- Desktop Menu -->
10- < div class ="hidden md:flex space-x-6 ">
10+ < div class ="hidden md:flex items-center space-x-6 ">
1111 < a href ="#services " class ="text-gray-700 hover:text-indigo-600 text-lg font-medium transition-colors duration-200 " i18n > Services</ a >
1212 < a href ="#portifolio " class ="text-gray-700 hover:text-indigo-600 text-lg font-medium transition-colors duration-200 " i18n > Our apps</ a >
1313 < a href ="#contact " class ="text-gray-700 hover:text-indigo-600 text-lg font-medium transition-colors duration-200 " i18n > Contact</ a >
14+ < app-language-switcher displayMode ="dropdown "> </ app-language-switcher >
1415 </ div >
1516
1617 <!-- Hamburger Button -->
3435 < a href ="#services " (click) ="closeMenu() " class ="block w-full text-center px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-indigo-600 hover:bg-gray-50 " i18n > Services</ a >
3536 < a href ="#portifolio " (click) ="closeMenu() " class ="block w-full text-center px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-indigo-600 hover:bg-gray-50 " i18n > Our apps</ a >
3637 < a href ="#contact " (click) ="closeMenu() " class ="block w-full text-center px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-indigo-600 hover:bg-gray-50 " i18n > Contact</ a >
38+ < div class ="border-t border-gray-200 w-full my-2 "> </ div >
39+ < app-language-switcher displayMode ="inline "> </ app-language-switcher >
3740 </ div >
3841 </ div >
3942</ nav >
Original file line number Diff line number Diff line change 11import { Component } from '@angular/core' ;
22import { CommonModule } from '@angular/common' ;
3+ import { LanguageSwitcher } from '../language-switcher/language-switcher' ;
34
45@Component ( {
56 selector : 'app-navigation' ,
67 standalone : true ,
7- imports : [ CommonModule ] ,
8+ imports : [ CommonModule , LanguageSwitcher ] ,
89 templateUrl : './navigation.html' ,
910} )
1011export class Navigation {
You can’t perform that action at this time.
0 commit comments