# All files / components/WidgetBox index.js

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

    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

    1x

    1x

    1x

    3x
    3x

    1x

    1x

    1x
    1x
    1x

    1x

     import React from 'react';
    import PropTypes from 'prop-types';
    import styled from 'styled-components';

    import WidgetBoxHeader from './Header';
    import WidgetBoxFooter from './Footer';
    import WidgetBoxBody from './Body';
    import { themeColor } from '../../utils/style';

    const StyledWidgetBoxContainer = styled.div`
      border-radius: 10px 10px 0px 0px;
      box-shadow: 0px 0px 8px 1px rgba(0,0,0,0.44);

      margin: 0;
      width: 100%;
      height: 100%;

      display: flex;
      flex-direction: column;

      background-color: ${(props) => themeColor(props.theme, 'background', 'base')};
    `;

    const WidgetBox = (props) => {
      const {
        className,
        children,
      } = props;
      return (
        <StyledWidgetBoxContainer className={className}>{children}</StyledWidgetBoxContainer>
      );
    };

    WidgetBox.propTypes = {
      children: PropTypes.node,
      className: PropTypes.string,
    };

    WidgetBox.defaultProps = {
      className: 'LT-WidgetBox-Container',
    };

    WidgetBox.Header = WidgetBoxHeader;
    WidgetBox.Footer = WidgetBoxFooter;
    WidgetBox.Body = WidgetBoxBody;

    WidgetBox.displayName = 'WidgetBox';

    export default WidgetBox;