Now that findings are aggregated, added events amount counter badge

This commit is contained in:
Shay Nehmad 2019-09-01 12:09:26 +03:00
parent 3f2d5b1479
commit e7953defdc
1 changed files with 13 additions and 10 deletions

View File

@ -1,9 +1,7 @@
import React, {Component} from "react";
import React, {Component, Fragment} from "react";
import EventsModal from "./EventsModal";
import {Button} from "react-bootstrap";
import FileSaver from "file-saver";
import {Badge, Button} from "react-bootstrap";
import * as PropTypes from "prop-types";
import ExportEventsButton from "./ExportEventsButton";
export default class EventsButton extends Component {
constructor(props) {
@ -22,16 +20,21 @@ export default class EventsButton extends Component {
};
render() {
return (
<div>
<EventsModal events={this.props.events} showEvents={this.state.isShow} hideCallback={this.hide} exportFilename={this.props.exportFilename} />
let eventsAmountBadge;
if (this.props.events.length > 10) {
eventsAmountBadge = <Badge>9+</Badge>;
} else {
eventsAmountBadge = <Badge>{this.props.events.length}</Badge>;
}
return <Fragment>
<EventsModal events={this.props.events} showEvents={this.state.isShow} hideCallback={this.hide}
exportFilename={this.props.exportFilename}/>
<div className="text-center" style={{"display": "grid"}}>
<Button className="btn btn-primary btn-lg" onClick={this.show}>
<i className="fa fa-list"/> Events
<i className="fa fa-list"/> Events {eventsAmountBadge}
</Button>
</div>
</div>
);
</Fragment>;
}
}