# All files / components/BandwidthProvider BandwidthProvider.js

75% Statements 3/4
100% Branches 0/0
0% Functions 0/1
75% Lines 3/4

    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
    29
    30
    31
    32
    33

    4x

    4x

    4x

     import React from 'react';
    import PropTypes from 'prop-types';
    import { withProps } from 'recompose';
    import BandwidthThemeProvider from '../BandwidthThemeProvider';
    import DefaultStyleRoot from './styles/StyleRoot';
    import withDragDropContext from './withDragDropContext';
    import DefaultDragLayer from '../DragLayer';
    import './styles/global'; // injects a global stylesheet

    const Provider = ({ StyleRoot, ThemeProvider, DragLayer, children }) => (
      <ThemeProvider>
        <StyleRoot>
          {children}
          <DragLayer />
        </StyleRoot>
      </ThemeProvider>
    );

    Provider.propTypes = {
      StyleRoot: PropTypes.func,
      ThemeProvider: PropTypes.func,
      DragLayer: PropTypes.func,
      children: PropTypes.node.isRequired,
    };

    Provider.defaultProps = {
      StyleRoot: DefaultStyleRoot,
      ThemeProvider: BandwidthThemeProvider,
      DragLayer: DefaultDragLayer,
    };

    export default withDragDropContext(Provider);