Files
blitzkit/packages/website/src/components/LinkI18n.tsx
T
2025-09-27 16:07:45 -05:00

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} />
);
}