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, headless: PropTypes.bool, }; static defaultProps = { headless: false, }; render() { return (
{!this.props.headless && (
{this.getHeader()}
)}
{this.props.children}
); } getHeader = () => { if (this.props.customHeader) { return this.props.customHeader; } else { return (
{this.props.headerTitle}
{this.props.children.length}
); } }; }