mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
15 lines
487 B
TypeScript
15 lines
487 B
TypeScript
import { DEFAULT_LOCALE } from '@blitzkit/i18n';
|
|
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 === DEFAULT_LOCALE ? '' : `/${locale}`;
|
|
|
|
return (
|
|
<Link href={href?.startsWith('/') ? `${prefix}${href}` : href} {...props} />
|
|
);
|
|
}
|