import React from 'react'; import { useDictionary } from '@sensoro/core'; import { APP_TYPE } from '../../types'; import ApplicationDigest from '../application-digest'; export interface AppBannerProps { appType: APP_TYPE; statistics: any[]; } const AppBanner: React.FC = props => { const { appType, children, statistics = [] } = props; const { getAppByType } = useDictionary(); const appInfo = getAppByType(appType); const renderChildren = () => { if (typeof children === 'function') { return children(appInfo, statistics); } else if (children) { return React.Children.map(children, (child: any) => React.cloneElement(child, { applicationInfo: appInfo, digestData: statistics, }), ); } else { return ( ); } }; // const renderChildren = () => { // return React.Children.map(children, (child: any) => // React.cloneElement(child, { // applicationInfo: appInfo, // digestData: data || [], // }), // ); // }; return
{renderChildren()}
; }; export default AppBanner;