import { widont } from 'journalize';
import MarkdownContent from "../../../content/MarkdownContent/index.js";
import ElectionLink from "../../ElectionLink/index.js";
import classes from './styles.module.scss';
const Headline = function Headline(props) {
  const {
    text,
    as: Tag,
    link
  } = props;
  const child = typeof text !== 'string' ? text : <MarkdownContent source={widont(text)} inline unstyled />;
  return <Tag className={classes.container}>
      <ElectionLink to={link}>
        <span className={classes.text}>
          {child}
        </span>
      </ElectionLink>
    </Tag>;
};
Headline.defaultProps = {
  as: 'h1'
};
export default Headline;