mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-15 21:56:10 +01:00
feat: some locale links
This commit is contained in:
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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user