File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 162
162
position: relative;
163
163
` ;
164
164
button . title = "View this page in other languages" ;
165
- button . textContent = "🌐" ;
165
+ button . innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="var(--geist-foreground)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide size-5"><path d="m5 8 6 6"></path><path d="m4 14 6-6 2-3"></path><path d="M2 5h12"></path><path d="M7 2h1"></path><path d="m22 22-5-10-5 10"></path><path d="M14 18h6"></path></svg>` ;
166
166
button . addEventListener ( "mouseenter" , ( ) => {
167
167
button . style . backgroundColor = "#f1f3f4" ;
168
168
button . style . transform = "scale(1.1)" ;
242
242
option . style . backgroundColor = "transparent" ;
243
243
} ) ;
244
244
option . addEventListener ( "click" , ( ) => {
245
+ hideDropdown ( ) ;
245
246
try {
246
247
const currentPath = window . location . pathname ;
247
248
const targetUrl = new URL ( currentPath , locale . url ) . href ;
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ function createTranslationDropdown() {
54
54
position: relative;
55
55
` ;
56
56
button . title = 'View this page in other languages' ;
57
- button . textContent = '🌐' ;
57
+ button . innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="var(--geist-foreground)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide size-5"><path d="m5 8 6 6"></path><path d="m4 14 6-6 2-3"></path><path d="M2 5h12"></path><path d="M7 2h1"></path><path d="m22 22-5-10-5 10"></path><path d="M14 18h6"></path></svg>` ;
58
58
59
59
// Add hover effects
60
60
button . addEventListener ( 'mouseenter' , ( ) => {
@@ -157,6 +157,9 @@ function createTranslationDropdown() {
157
157
} ) ;
158
158
159
159
option . addEventListener ( 'click' , ( ) => {
160
+ // Close the dropdown immediately when a locale is clicked
161
+ hideDropdown ( ) ;
162
+
160
163
try {
161
164
const currentPath = window . location . pathname ;
162
165
const targetUrl = new URL ( currentPath , locale . url ) . href ;
You can’t perform that action at this time.
0 commit comments