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

44 lines
1.1 KiB
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,
2020-04-09 07:21:43 -03:00
headless: PropTypes.bool,
};
static defaultProps = {
headless: false,
2019-08-13 15:36:46 -04:00
};
render() {
return (
<div className="tableList">
2020-04-09 07:21:43 -03:00
{!this.props.headless && (
<div className="tableListHeader" onClick={this.onHeaderClick}>
{this.getHeader()}
</div>
)}
2019-08-13 15:36:46 -04:00
<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>
);
}
};
}