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