All files / answers-chart/components/Title index.jsx

70% Statements 7/10
25% Branches 1/4
100% Functions 2/2
70% Lines 7/10
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        1x 1x               1x       1x 1x         1x       1x          
import React from 'react';
import PropTypes from 'prop-types';
import { ChartTitle } from '@bufferapp/analyze-shared-components';
 
const getTitle = (metricType) => {
  switch (metricType) {
    case 'day':
      return 'Which is the best day to post?';
    case 'type':
      return 'Which is the best type of post?';
    case 'frequency':
      return 'Which is the best frequency to post?';
    default:
      break;
  }
};
 
const Title = ({ forReport, metricType }) => (
  <ChartTitle forReport={forReport}>
    {getTitle(metricType)}
  </ChartTitle>
);
 
Title.propTypes = {
  forReport: PropTypes.bool,
};
 
Title.defaultProps = {
  forReport: false,
};
 
export default Title;