mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-24 06:34:18 +01:00
rename methods
This commit is contained in:
1 parent
ec161addab
commit
5f737d940d
111 files changed
+563
-413
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { ErrorWrapper } from "../components/ErrorWrapper";
|
||||
|
||||
export function withErrorWrapper<Props extends object>(
|
||||
Component: (props: Props) => ReactNode,
|
||||
) {
|
||||
return function (props: Props) {
|
||||
return (
|
||||
<ErrorWrapper>
|
||||
<Component {...props} />
|
||||
</ErrorWrapper>
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { LocaleProvider } from "../hooks/useLocale";
|
||||
|
||||
interface WithLocaleProps {
|
||||
locale: string;
|
||||
}
|
||||
|
||||
export function withLocale<Props extends object>(
|
||||
Component: (props: Props) => ReactNode,
|
||||
) {
|
||||
return function ({ locale, ...props }: Props & WithLocaleProps) {
|
||||
return (
|
||||
<LocaleProvider locale={locale}>
|
||||
<Component {...(props as Props)} />
|
||||
</LocaleProvider>
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user