import React from 'react';
import PropTypes from 'prop-types';
import { componentWithName } from 'airbnb-prop-types';
import './style.css';

var TableofContents = function TableofContents(props) {
  return React.createElement(
    'nav',
    { className: 'ma__toc--hierarchy' },
    props.heading,
    React.createElement(
      'ul',
      { className: 'ma__toc--hierarchy__container' },

      // eslint-disable-next-line react/prop-types
      React.Children.map(props.children, function (child) {
        return React.createElement(
          'li',
          null,
          child
        );
      })
    )
  );
};

TableofContents.propTypes = process.env.NODE_ENV !== "production" ? {
  /** The heading text  */
  heading: PropTypes.oneOfType([componentWithName('ColoredHeading'), componentWithName('SidebarHeading')])
} : {};

export default TableofContents;