16
src/components/links/LocaleLink.astro
Normal file
16
src/components/links/LocaleLink.astro
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
import { languageTag, type AvailableLanguageTag } from "@/paraglide/runtime"
|
||||
import { localizePathname, type NavLink } from "@/utils/linking"
|
||||
import type { ComponentProps } from "@/types/props"
|
||||
|
||||
interface Props extends ComponentProps {
|
||||
to: NavLink
|
||||
lang?: AvailableLanguageTag
|
||||
}
|
||||
|
||||
const { to, class: clazz, lang = languageTag() } = Astro.props
|
||||
---
|
||||
|
||||
<a href={localizePathname(to, lang)} class={clazz}>
|
||||
<slot />
|
||||
</a>
|
Reference in New Issue
Block a user