From 84247644ffb35156b151ab3a685ccedcae6494a4 Mon Sep 17 00:00:00 2001 From: ONS-Tom Date: Mon, 20 Nov 2017 11:17:27 +0000 Subject: [PATCH] Feature/export to csv (#12) * Add export to csv functionality - Using utils/export - Copied from the business-index-ui * Add config/export with name of CSV * Add export to JSON button to ResultsTable --- src/components/ResultsTable.js | 12 ++++++++- src/config/export.js | 5 ++++ src/utils/export.js | 47 ++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/config/export.js create mode 100644 src/utils/export.js diff --git a/src/components/ResultsTable.js b/src/components/ResultsTable.js index ff2b475..2c18206 100644 --- a/src/components/ResultsTable.js +++ b/src/components/ResultsTable.js @@ -5,6 +5,7 @@ import 'react-table/react-table.css'; import SummaryTable from '../components/SummaryTable'; import ChildRefTable from '../components/ChildRefTable'; import { employmentBands, legalStatusBands, tradingStatusBands, turnoverBands } from '../utils/convertBands'; +import { downloadCSV, downloadJSON } from '../utils/export'; const ResultsTable = ({ results, showFilter, showPagination, defaultPageSize, convertBands }) => { return ( @@ -63,7 +64,16 @@ const ResultsTable = ({ results, showFilter, showPagination, defaultPageSize, co ); }} /> -

+
+
+
+

Export Results

+ +   + +
+
+