import GeneralHeader from './GeneralHeader';
import PrimaryHeader from './PrimaryHeader';

/**
 * This component decides what information to show in the header.
 * For primaries, we have two levels of headers, and therefore only
 * are concerned about the district name.
 * But in the general we only have one contest to show
 * and therefore want to show contest-level info in the header.
 */
const DistrictHeader = function DistrictHeader(props) {
  const {
    districtNumber,
    stateFips,
    blocks
  } = props;
  if (blocks.length > 1) {
    return <PrimaryHeader districtNumber={districtNumber} stateFips={stateFips} />;
  }
  return <GeneralHeader contestId={blocks[0].contestId} />;
};
export default DistrictHeader;