Skip to content

Commit 95a1809

Browse files
committed
feat: 選択している言語をわかりやすくする
1 parent cfe4ad8 commit 95a1809

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

2025/src/components/LanguagePicker.astro

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
22
import { languages } from '../i18n/ui';
33
import { base } from "astro:config/client"
4+
5+
const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, "");
46
---
57
<ul class="language-picker">
68
{Object.entries(languages).map(([lang, label]) => (
7-
<li>
9+
<li class:list= {[{ active: pathname.startsWith(`/${label}`) }]} >
810
<a href={`${base}/${lang}/`}>{label}</a>
911
</li>
1012
))}
@@ -18,12 +20,23 @@ ul {
1820
display: flex;
1921
justify-content: flex-end;
2022
margin-right: 1rem;
23+
24+
a {
25+
text-decoration: none;
26+
}
27+
2128
}
2229

2330
li:first-child::after {
2431
content: '/';
2532
display: 'inline block'
2633
margin: 0 8px;
2734
color: #333;
35+
36+
}
37+
38+
li.active > a {
39+
font-weight: bold;
40+
text-decoration: underline;
2841
}
2942
</style>

0 commit comments

Comments
 (0)