import React, { Component } from 'react'; import PropTypes from 'prop-types'; import './TableList.styl'; export class TableList extends Component { static propTypes = { customHeader: PropTypes.node, defaultItems: PropTypes.object, children: PropTypes.node.isRequired, headerTitle: PropTypes.string, }; render() { return (
{this.getHeader()}
{this.props.children}
); } getHeader = () => { if (this.props.customHeader) { return this.props.customHeader; } else { return (
{this.props.headerTitle}
{this.props.children.length}
); } }; }