All files / src/components/Loader Loader.tsx

0% Statements 0/6
0% Branches 0/2
0% Functions 0/1
0% Lines 0/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28                                                       
import React from 'react';
 
import {Loader as BaseLoader, LoaderProps as BaseLoaderProps} from '@gravity-ui/uikit';
 
import type {ChartKitRenderPluginLoader} from '../../types';
import {block} from '../../utils/cn';
 
import './Loader.scss';
 
const b = block('loader');
 
type LoaderProps = BaseLoaderProps & {renderPluginLoader?: ChartKitRenderPluginLoader};
 
export const Loader = ({renderPluginLoader, ...props}: LoaderProps) => {
    const pluginLoader = renderPluginLoader?.();
 
    // React.Suspense complains about possible undefined in "fallback" property
    if (typeof pluginLoader !== 'undefined') {
        return pluginLoader as React.JSX.Element;
    }
 
    return (
        <div className={b()}>
            <BaseLoader {...props} />
        </div>
    );
};