# All files / components/Loader Loader.js

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

    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
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57

     import React from 'react';
    import PropTypes from 'prop-types';
    import LoaderRing from './styles/LoaderRing';
    import LoaderContainer from './styles/LoaderContainer';

    class Loader extends React.Component {
      static propTypes = {
        /**
         * The size of each loader 'dot'. Can be any CSS dimension string.
         */
        size: PropTypes.string,
        /**
         * The color of the loader. Defaults to the primary theme color.
         */
        color: PropTypes.string,
        /**
         * Adds a class name to the element.
         */
        className: PropTypes.string,
        /**
         * Adds an id to the element.
         */
        id: PropTypes.string,
        /**
         * A component for rendering a ring of the loader
         */
        Ring: PropTypes.func,
        /**
         * A component for rendering the containing block of the loader
         */
        Container: PropTypes.func,
      };

      static defaultProps = {
        size: '20px',
        color: null,
        className: null,
        id: null,
        Ring: LoaderRing,
        Container: LoaderContainer,
      };

      render() {
        const { size, color, id, className, Container, Ring } = this.props;

        return (
          <Container id={id} className={className}>
            <Ring size={size} color={color} />
            <Ring size={size} color={color} />
            <Ring size={size} color={color} />
          </Container>
        );
      }
    }

    export default Loader;