feat: some locale links

This commit is contained in:
tresabhi committed 2024-12-27 13:43:25 -06:00
1 parent eb5527706e
commit 8203db3dc2
4 files changed
+47 -12

No files matched your search

@@ -0,0 +1,19 @@
import { Link, type LinkProps } from '@radix-ui/themes';
import { getBestLocale } from '../core/i18n/getBestLocale';
type LinkI18nProps = LinkProps & {
locale: string | undefined;
};
export function LinkI18n({ locale, href, ...props }: LinkI18nProps) {
const bestLocale = getBestLocale();
const resolvedLocale = locale ?? bestLocale;
const prefix = resolvedLocale === undefined ? '' : `/${resolvedLocale}`;
return (
<Link
href={href === undefined ? undefined : `${prefix}${href}`}
{...props}
/>
);
}