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

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-08-13 15:36:46 -04:00
import './TableListItem.styl';
import { Component } from 'react';
import { Icon } from './../../elements/Icon';
import PropTypes from 'prop-types';
import React from 'react';
export class TableListItem extends Component {
static propTypes = {
children: PropTypes.node,
itemClass: PropTypes.string,
itemIndex: PropTypes.number,
itemKey: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
2019-08-13 15:36:46 -04:00
onItemClick: PropTypes.func.isRequired,
};
render() {
return (
<div
className={`tableListItem ${this.props.itemClass}`}
onClick={this.onItemClick}
>
<div className="itemIndex">
{this.props.itemIndex}
<span className="warning-icon">
<Icon name="exclamation-triangle" />
</span>
</div>
<div className="itemContent">{this.props.children}</div>
</div>
);
}
onItemClick = event => {
if (this.props.onItemClick) {
event.preventDefault();
event.stopPropagation();
this.props.onItemClick(event, this.props.itemKey);
}
};
}