Skip to content

Commit 5592481

Browse files
committed
feat: replace flag icon with text in language switcher
- Remove flag icon from language switcher - Show simple 'EN' or 'VI' text instead - Simpler, cleaner, and more reliable than flag icons - Adjust padding from p-2 to px-3 py-2 for better text spacing
1 parent 6498d93 commit 5592481

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/LanguageSwitcher.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
---
22
import { languages, defaultLang, getLangFromUrl, getLocalizedPath } from '@i18n/utils';
3-
import FlagIcon from './FlagIcon.astro';
43
54
const currentLang = getLangFromUrl(Astro.url);
65
const currentPath = Astro.url.pathname.replace(new RegExp(`^/${currentLang}`), '') || '/';
76
87
// Generate alternate language URL
98
const alternateLang = currentLang === 'en' ? 'vi' : 'en';
109
const alternateUrl = getLocalizedPath(currentPath, alternateLang);
11-
const alternateCountry = alternateLang === 'en' ? 'us' : 'vn';
1210
---
1311

1412
<div class="language-switcher">
1513
<a
1614
href={alternateUrl}
17-
class="flex items-center justify-center p-2 rounded-lg bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 transition-colors"
15+
class="flex items-center justify-center px-3 py-2 rounded-lg bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 transition-colors"
1816
aria-label={`Switch to ${languages[alternateLang]}`}
1917
title={`Switch to ${languages[alternateLang]}`}
2018
>
21-
<FlagIcon country={alternateCountry} class="w-6 h-6" />
19+
<span class="text-sm font-medium">
20+
{alternateLang.toUpperCase()}
21+
</span>
2222
</a>
2323
</div>
2424

0 commit comments

Comments
 (0)