import PropTypes from 'prop-types';
import ElectionLink from "../../../../ElectionLink/index.js";
import { prependContext } from "../../../../../../utils/tracking/index.js";
import classes from './styles.module.scss';
const Name = function Name(props) {
  const {
    name: nameData,
    tracking
  } = props;
  const nameAndUrl = typeof nameData === 'string' ? {
    name: nameData
  } : nameData;
  const {
    name,
    url
  } = nameAndUrl;
  const trackingContext = prependContext({
    prefix: tracking.context,
    context: 'BioLink'
  });
  return <span className={classes.name}>
      <ElectionLink to={url} tracking={{
      ...tracking,
      context: trackingContext
    }}>
        {name}
      </ElectionLink>
    </span>;
};
Name.defaultProps = {
  tracking: {
    context: undefined
  }
};
Name.propTypes = {
  name: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
    name: PropTypes.string,
    tagline: PropTypes.string,
    link: PropTypes.string
  })]).isRequired,
  tracking: PropTypes.shape({
    context: PropTypes.string
  })
};
export default Name;