import PropTypes from 'prop-types';
import { widont } from 'journalize';
import ElectionMarkdown from "../../content/ElectionMarkdown/index.js";
import classes from './styles.module.scss';

/**
 * The description or dek of a module.
 */
const ModuleDescription = function ModuleDescription(props) {
  const {
    children
  } = props;
  const child = typeof children !== 'string' ? children : <ElectionMarkdown source={widont(children)} unstyled />;
  return <div className={classes.description}>
      {child}
    </div>;
};
ModuleDescription.defaultProps = {
  children: undefined
};
ModuleDescription.propTypes = {
  /**
   * The contents of the description.
   */
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)])
};
export default ModuleDescription;