# All files / components/Cards CardHeader.js

0% Statements 0/35
0% Branches 0/8
0% Functions 0/4
0% Lines 0/9

    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

     import React from 'react';
    import PropTypes from 'prop-types';
    import DefaultHeaderWrapper from './styles/HeaderWrapper';
    import DefaultCardHeaderText from './styles/CardHeaderText';

    class CardHeader extends React.Component {
      static propTypes = {
        /**
         * The text to be displayed in the header.  Optional.  Text is displayed in white font by default.
         */
        title: PropTypes.string,
        /**
         * The image to be displayed as the background of the header.  If omitted, no background image is used.
         */
        image: PropTypes.string,
        /**
         * A component which controls the styling of the CardHeader
         */
        HeaderWrapper: PropTypes.func,
        /**
         * A component which controls the appearance of the text in the Card Header
         */
        CardHeaderText: PropTypes.func,
      };

      static defaultProps = {
        title: null,
        image: null,
        HeaderWrapper: DefaultHeaderWrapper,
        CardHeaderText: DefaultCardHeaderText,
      };

      render() {
        const { image, title, HeaderWrapper, CardHeaderText } = this.props;

        return (
          <HeaderWrapper image={image}>
            {title ? <CardHeaderText>{title}</CardHeaderText> : null}
          </HeaderWrapper>
        );
      }
    }

    export default CardHeader;