all files / src/components/ OptionDescription.jsx

100% Statements 9/9
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7
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                                            
import React from 'react';
import PropTypes from 'prop-types';
 
import InfoTooltipWithTrigger from './InfoTooltipWithTrigger';
 
const propTypes = {
  option: PropTypes.object.isRequired,
};
 
// This component provides a general tooltip for options
// in a SelectControl
export default function OptionDescription({ option }) {
  return (
    <span>
      <span className="m-r-5 option-label">
        {option.label}
      </span>
      {option.description &&
        <InfoTooltipWithTrigger
          className="m-r-5 text-muted"
          icon="question-circle-o"
          tooltip={option.description}
          label={`descr-${option.label}`}
        />
      }
    </span>);
}
OptionDescription.propTypes = propTypes;