Files
ohif-viewer/platform/ui/src/components/tableList/TableList.js
T

37 lines
946 B
JavaScript
Raw Normal View History

2019-08-13 15:36:46 -04:00
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 (
<div className="tableList">
<div className="tableListHeader" onClick={this.onHeaderClick}>
{this.getHeader()}
</div>
<div className="tableListContent">{this.props.children}</div>
</div>
);
}
getHeader = () => {
if (this.props.customHeader) {
return this.props.customHeader;
} else {
return (
<React.Fragment>
<div className="tableListHeaderTitle">{this.props.headerTitle}</div>
<div className="numberOfItems">{this.props.children.length}</div>
</React.Fragment>
);
}
};
}