# All files / components/Cards OldCardHeader.js

40% Statements 2/5
0% Branches 0/4
0% Functions 0/2
40% Lines 2/5

    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

    5x

    5x

     import React from 'react';
    import styled from 'styled-components';
    import PropTypes from 'prop-types';
    import H3 from 'components/H/H3';
    import themeGet from 'extensions/themeGet';

    const OuterContainer = styled.div`
      color: ${themeGet('colors.background.default')};
      font-size: 1.2em;
      font-weight: 500;
      text-transform: uppercase;
      background-image: url(${props => props.image || 'none'});
      background-size: cover;
      padding: ${themeGet('spacing.medium')};
      padding-top: ${themeGet('spacing.extraLarge')};
      border-top-left-radius: inherit;
      border-top-right-radius: inherit;
      flex: 1;
    `;

    const WhiteHeader = H3.extend`
      color: ${themeGet('colors.text.inverted')};
    `;

    class CardHeader extends React.Component {
      static propTypes = {
        text: PropTypes.string,
        image: PropTypes.string,
      };

      static defaultProps = {
        text: null,
        image: null,
      };

      render() {
        const { image, text } = this.props;

        return (
          <OuterContainer image={image}>
            { (text) ? <WhiteHeader>{text}</WhiteHeader> : null }
          </OuterContainer>
        );
      }
    }

    export default CardHeader;