Skip to content

Commit 9c9bb6d

Browse files
committed
lint fix
1 parent c5d0e9c commit 9c9bb6d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/elements/dropdown/components/NavigationalDropdownContainer.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ const injectBackClickIntoDropdownHeader = (
1717
): React.ReactNode => Children.map(children, (child) => {
1818
if (!isValidElement(child)) return child;
1919

20-
if (hasDisplayName(child, 'DropdownHeader')) {
20+
if (hasDisplayName(child, 'DropdownHeader'))
2121
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2222
return cloneElement(child as any, {
2323
onBackClick: handleBackClick
2424
});
25-
}
25+
2626

2727
return child;
2828
});
@@ -46,13 +46,17 @@ export const NavigationalDropdownContainer: React.FC<NavigationalDropdownContain
4646
const dropdownElement = currentContent;
4747

4848
if (hasDisplayName(dropdownElement, 'Dropdown')) {
49-
const {children: dropdownChildren, className: propsClassName} = dropdownElement.props;
49+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50+
const props = dropdownElement.props as any;
51+
const dropdownChildren = props.children;
52+
const propsClassName = props.className;
5053

5154
if (dropdownChildren) {
5255
const modifiedChildren = injectBackClickIntoDropdownHeader(dropdownChildren, handleBackClick);
5356

54-
return cloneElement(dropdownElement, {
55-
...dropdownElement.props,
57+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
58+
return cloneElement(dropdownElement as any, {
59+
...props,
5660
children: modifiedChildren,
5761
className: className || propsClassName
5862
});

src/elements/dropdown/dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const Dropdown: FC<DropdownProps> = ({
169169
const hasSubmenus = useMemo(
170170
() =>
171171
React.Children.toArray(children).some((child) => {
172-
if (!isValidElement(child) || !child.props) return false;
172+
if (!isValidElement(child) || !child.props || typeof child.props !== 'object') return false;
173173
return 'submenu' in child.props && Boolean(child.props.submenu);
174174
}),
175175
[children]

0 commit comments

Comments
 (0)