mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-04 23:32:54 +01:00
migrate 2
This commit is contained in:
1 parent
9839d4eef5
commit
cfc0ebb8e5
18 files changed
+348
-266
No files matched your search
@@ -1,14 +1,15 @@
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { Link, type LinkProps } from "@radix-ui/themes";
|
||||
import type { LocaleAcceptorProps } from "../hooks/useLocale";
|
||||
import { Link, type LinkProps } from "./Link";
|
||||
|
||||
type LinkI18nProps = LinkProps & LocaleAcceptorProps;
|
||||
|
||||
export function LinkI18n({ locale, href, ...props }: LinkI18nProps) {
|
||||
const prefix =
|
||||
locale === undefined || locale === locales.default ? "" : `/${locale}`;
|
||||
export interface LinkI18n extends LinkProps {
|
||||
locale: string;
|
||||
}
|
||||
|
||||
export function LinkI18n({ locale, href, ...props }: LinkI18n) {
|
||||
return (
|
||||
<Link href={href?.startsWith("/") ? `${prefix}${href}` : href} {...props} />
|
||||
<Link
|
||||
href={`${locale === locales.default ? "" : `/${locale}`}${href}`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user