# All files / components/HelpText HelpText.js

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/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
    34
    35
    36
    37
    38

    4x

    4x

    4x

    4x

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

    const HelpText = styled.div.withConfig({ displayName: 'HelpText' })`
      color: ${props =>
        props.error ? get('colors.negative.default') : get('colors.gray.medium')};
      font-style: italic;
      font-weight: 300;
      font-family: ${get('fonts.brand')};
    `;

    HelpText.propTypes = {
      /**
       * Adds a class name to the element.
       */
      className: PropTypes.string,
      /**
       * Adds an id to the element.
       */
      id: PropTypes.string,
      /**
       * Whether this help text is in an error state
       */
      error: PropTypes.bool,
    };

    HelpText.defaultProps = {
      className: null,
      id: null,
    };

    /**
     * @component
     */
    export default HelpText;