PromoCursed/node_modules/antd/es/layout/hooks/useHasSider.js

12 lines
351 B
JavaScript
Raw Normal View History

2024-08-20 23:25:37 +04:00
import toArray from "rc-util/es/Children/toArray";
import Sider from '../Sider';
export default function useHasSider(siders, children, hasSider) {
if (typeof hasSider === 'boolean') {
return hasSider;
}
if (siders.length) {
return true;
}
const childNodes = toArray(children);
return childNodes.some(node => node.type === Sider);
}