import PropTypes from 'prop-types';
import get from 'lodash/get';
import { useContestMetadata } from "../../../hooks/election/index.js";
import PartyName from '../PartyName';
const ContestParty = function ContestParty(props) {
  const {
    id,
    ...restProps
  } = props;
  const metadata = useContestMetadata(id);
  const party = get(metadata, 'party');
  if (!party) return null;
  return <PartyName id={party} {...restProps} />;
};
ContestParty.defaultProps = {};
ContestParty.propTypes = {
  /**
   * The ID of the contest whose party you want to format.
   */
  id: PropTypes.string.isRequired
};
export default ContestParty;