Fixe The missing buttons
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
import { usePage } from '@inertiajs/react';
|
||||
import {
|
||||
Children,
|
||||
cloneElement,
|
||||
isValidElement,
|
||||
useCallback,
|
||||
useMemo,
|
||||
} from 'react';
|
||||
import { cloneElement, isValidElement, useCallback, useMemo } from 'react';
|
||||
import type { ReactElement, ReactNode } from 'react';
|
||||
import type { TranslationReplacements, Translations } from '@/types';
|
||||
|
||||
@@ -32,16 +26,19 @@ export function translateChildren(
|
||||
children: ReactNode,
|
||||
translate: Translate,
|
||||
): ReactNode {
|
||||
return Children.map(children, (child) => {
|
||||
if (typeof child === 'string') {
|
||||
return translateTextNode(child, translate);
|
||||
if (Array.isArray(children)) {
|
||||
return children.map((child) => translateChildren(child, translate));
|
||||
}
|
||||
|
||||
if (!isValidElement(child)) {
|
||||
return child;
|
||||
if (typeof children === 'string') {
|
||||
return translateTextNode(children, translate);
|
||||
}
|
||||
|
||||
const element = child as ReactElement<{ children?: ReactNode }>;
|
||||
if (!isValidElement(children)) {
|
||||
return children;
|
||||
}
|
||||
|
||||
const element = children as ReactElement<{ children?: ReactNode }>;
|
||||
|
||||
if (!element.props.children) {
|
||||
return element;
|
||||
@@ -52,7 +49,6 @@ export function translateChildren(
|
||||
undefined,
|
||||
translateChildren(element.props.children, translate),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function useTranslation(): {
|
||||
|
||||
Reference in New Issue
Block a user