@bento-core/table 1.0.1-ccdihub.23 → 1.0.1-ccdihub.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _core = require("@material-ui/core");
10
- var _icons = require("@material-ui/icons");
10
+ var _DownloadButton = _interopRequireDefault(require("./components/DownloadButton"));
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
13
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -45,10 +45,6 @@ const downloadAreaStyle = {
45
45
  borderBottom: '1px solid #8A7F7C',
46
46
  paddingRight: '41px'
47
47
  };
48
- const downloadButtonStyle = {
49
- color: '#d1d2d3',
50
- marginTop: '7px'
51
- };
52
48
  const CustomPagination = _ref => {
53
49
  let {
54
50
  rowsPerPageOptions,
@@ -80,10 +76,8 @@ const CustomPagination = _ref => {
80
76
  },
81
77
  native: true
82
78
  }
83
- }), count > 0 ? /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
84
- title: "Download filtered results as a CSV"
85
- }, /*#__PURE__*/_react.default.createElement(_core.IconButton, null, /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, null))) : /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, {
86
- style: downloadButtonStyle
79
+ }), /*#__PURE__*/_react.default.createElement(_DownloadButton.default, {
80
+ count: count
87
81
  })));
88
82
  };
89
83
  CustomPagination.propTypes = {
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _core = require("@material-ui/core");
9
+ var _icons = require("@material-ui/icons");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const downloadButtonStyle = {
12
+ color: '#d1d2d3',
13
+ marginTop: '7px'
14
+ };
15
+ const DownloadButton = _ref => {
16
+ let {
17
+ count
18
+ } = _ref;
19
+ if (count === 0) {
20
+ return /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, {
21
+ style: downloadButtonStyle
22
+ });
23
+ }
24
+ return /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
25
+ title: "Download filtered results as a CSV"
26
+ }, /*#__PURE__*/_react.default.createElement(_core.IconButton, null, /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, null)));
27
+ };
28
+ var _default = DownloadButton;
29
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ccdihub.23",
3
+ "version": "1.0.1-ccdihub.24",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -4,10 +4,8 @@ import {
4
4
  createTheme,
5
5
  TablePagination,
6
6
  ThemeProvider,
7
- IconButton,
8
- Tooltip,
9
7
  } from '@material-ui/core';
10
- import { CloudDownload } from '@material-ui/icons';
8
+ import DownloadButton from './components/DownloadButton';
11
9
 
12
10
  const defaultTheme = {
13
11
  MuiTablePagination: {
@@ -42,11 +40,6 @@ const downloadAreaStyle = {
42
40
  paddingRight: '41px',
43
41
  };
44
42
 
45
- const downloadButtonStyle = {
46
- color: '#d1d2d3',
47
- marginTop: '7px',
48
- };
49
-
50
43
  const CustomPagination = ({
51
44
  rowsPerPageOptions,
52
45
  count,
@@ -71,17 +64,9 @@ const CustomPagination = ({
71
64
  native: true,
72
65
  }}
73
66
  />
74
- {
75
- count > 0
76
- ? (
77
- <Tooltip title="Download filtered results as a CSV">
78
- <IconButton>
79
- <CloudDownload />
80
- </IconButton>
81
- </Tooltip>
82
- )
83
- : <CloudDownload style={downloadButtonStyle} />
84
- }
67
+ <DownloadButton
68
+ count={count}
69
+ />
85
70
  </div>
86
71
  </ThemeProvider>
87
72
  );
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import {
3
+ IconButton,
4
+ Tooltip,
5
+ } from '@material-ui/core';
6
+ import { CloudDownload } from '@material-ui/icons';
7
+
8
+ const downloadButtonStyle = {
9
+ color: '#d1d2d3',
10
+ marginTop: '7px',
11
+ };
12
+
13
+ const DownloadButton = ({
14
+ count,
15
+ }) => {
16
+ if (count === 0) {
17
+ return <CloudDownload style={downloadButtonStyle} />;
18
+ }
19
+
20
+ return (
21
+ <Tooltip title="Download filtered results as a CSV">
22
+ <IconButton>
23
+ <CloudDownload />
24
+ </IconButton>
25
+ </Tooltip>
26
+ );
27
+ };
28
+
29
+ export default DownloadButton;