Skip to content

Commit 8a5fac8

Browse files
committed
feat: update translate icon
1 parent dc100c3 commit 8a5fac8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

apps/tampermonkey/dist/script.iife.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
position: relative;
163163
`;
164164
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>`;
166166
button.addEventListener("mouseenter", () => {
167167
button.style.backgroundColor = "#f1f3f4";
168168
button.style.transform = "scale(1.1)";
@@ -242,6 +242,7 @@
242242
option.style.backgroundColor = "transparent";
243243
});
244244
option.addEventListener("click", () => {
245+
hideDropdown();
245246
try {
246247
const currentPath = window.location.pathname;
247248
const targetUrl = new URL(currentPath, locale.url).href;

apps/tampermonkey/src/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function createTranslationDropdown() {
5454
position: relative;
5555
`;
5656
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>`;
5858

5959
// Add hover effects
6060
button.addEventListener('mouseenter', () => {
@@ -157,6 +157,9 @@ function createTranslationDropdown() {
157157
});
158158

159159
option.addEventListener('click', () => {
160+
// Close the dropdown immediately when a locale is clicked
161+
hideDropdown();
162+
160163
try {
161164
const currentPath = window.location.pathname;
162165
const targetUrl = new URL(currentPath, locale.url).href;

0 commit comments

Comments
 (0)