All files / javascripts/explorev2/components ControlLabelWithTooltip.jsx

0% Statements 0/9
0% Branches 0/2
0% Functions 0/1
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                                                     
import React, { PropTypes } from 'react';
import { ControlLabel } from 'react-bootstrap';
import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger';
 
const propTypes = {
  label: PropTypes.string.isRequired,
  description: PropTypes.string,
};
 
const defaultProps = {
  description: null,
};
 
export default function ControlLabelWithTooltip({ label, description }) {
  return (
    <ControlLabel>
      {label} &nbsp;
      {description &&
        <InfoTooltipWithTrigger label={label} tooltip={description} />
      }
    </ControlLabel>
  );
}
 
ControlLabelWithTooltip.propTypes = propTypes;
ControlLabelWithTooltip.defaultProps = defaultProps;