From 748b20c66c563ea86a130970705f81206fbb9831 Mon Sep 17 00:00:00 2001 From: Barry McGee Date: Wed, 8 Jan 2020 09:12:17 +0000 Subject: [PATCH] Action feedback --- src/components/MainTable/MainTable.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/MainTable/MainTable.js b/src/components/MainTable/MainTable.js index 563b14cbf..a00605d68 100644 --- a/src/components/MainTable/MainTable.js +++ b/src/components/MainTable/MainTable.js @@ -85,7 +85,7 @@ const generateRows = ( sortFunction ) => { // If the table has no rows, return empty state message - if (Object.entries(rows).length === 0) { + if (Object.entries(rows).length === 0 && emptyStateMsg) { return {emptyStateMsg}; } // Clone the rows so we can restore the original order. @@ -148,7 +148,7 @@ const generateRows = ( const MainTable = ({ defaultSort, defaultSortDirection, - emptyStateMsg = "No data to display", + emptyStateMsg = "", expanding, headers, onUpdateSort, @@ -229,7 +229,10 @@ const MainTable = ({ MainTable.propTypes = { defaultSort: PropTypes.string, defaultSortDirection: PropTypes.oneOf(["ascending", "descending"]), - emptyStateMsg: PropTypes.string, + /** + * A state that will be shown when no rows are passed to the table. + */ + emptyStateMsg: PropTypes.node, expanding: PropTypes.bool, headers: PropTypes.arrayOf( PropTypes.shape({