mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-14 13:16:11 +01:00
15 lines
490 B
TypeScript
15 lines
490 B
TypeScript
import locales from "@blitzkit/i18n/locales.json";
|
|
import { Link, type LinkProps } from "@radix-ui/themes";
|
|
import type { LocaleAcceptorProps } from "../hooks/useLocale";
|
|
|
|
type LinkI18nProps = LinkProps & LocaleAcceptorProps;
|
|
|
|
export function LinkI18n({ locale, href, ...props }: LinkI18nProps) {
|
|
const prefix =
|
|
locale === undefined || locale === locales.default ? "" : `/${locale}`;
|
|
|
|
return (
|
|
<Link href={href?.startsWith("/") ? `${prefix}${href}` : href} {...props} />
|
|
);
|
|
}
|