Skip to content

Commit

Permalink
disable download buttons when we don't have data yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Nospamas committed Dec 10, 2024
1 parent 8dc87df commit ea8048f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/graphs/ExportButtons/ExportButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class ExportButtons extends React.Component {
static propTypes = {
onExportXlsx: PropTypes.func.isRequired,
onExportCsv: PropTypes.func.isRequired,
disabled: PropTypes.bool,
};

render() {
Expand All @@ -22,8 +23,15 @@ export default class ExportButtons extends React.Component {
<ControlLabel className={styles.exportlabel}>
{downloadGraphDataLabel}
</ControlLabel>
<Button onClick={this.props.onExportXlsx}>{xslxButtonLabel}</Button>
<Button onClick={this.props.onExportCsv}>{csvButtonLabel}</Button>
<Button
disabled={this.props.disabled}
onClick={this.props.onExportXlsx}
>
{xslxButtonLabel}
</Button>
<Button disabled={this.props.disabled} onClick={this.props.onExportCsv}>
{csvButtonLabel}
</Button>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ export default class LongTermAveragesGraph extends React.Component {
)}
<Col lg={controlsWidth} md={controlsWidth} sm={controlsWidth}>
<ExportButtons
disabled={!this.state.data}
onExportXlsx={this.handleExportXlsx}
onExportCsv={this.handleExportCsv}
/>
Expand Down

0 comments on commit ea8048f

Please sign in to comment.