all files / src/components/ PopoverSection.jsx

100% Statements 9/9
100% Branches 6/6
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 30 31 32                                                  
import React from 'react';
import PropTypes from 'prop-types';
import InfoTooltipWithTrigger from './InfoTooltipWithTrigger';
 
const propTypes = {
  title: PropTypes.string.isRequired,
  isSelected: PropTypes.bool.isRequired,
  onSelect: PropTypes.func.isRequired,
  info: PropTypes.string,
  children: PropTypes.node.isRequired,
};
 
export default function PopoverSection({ title, isSelected, children, onSelect, info }) {
  return (
    <div className={'PopoverSection ' + (!isSelected ? 'dimmed' : '')}>
      <div onClick={onSelect} className="pointer">
        <strong>{title}</strong> &nbsp;
        {info &&
          <InfoTooltipWithTrigger
            tooltip={info}
            label="date-free-tooltip"
          />}
        &nbsp;
        <i className={isSelected ? 'fa fa-check text-primary' : ''} />
      </div>
      <div className="m-t-5 m-l-5">
        {children}
      </div>
    </div>);
}
PopoverSection.propTypes = propTypes;