-
Notifications
You must be signed in to change notification settings - Fork 375
Expand file tree
/
Copy pathTableBodyContainer.js
More file actions
38 lines (35 loc) · 1.14 KB
/
TableBodyContainer.js
File metadata and controls
38 lines (35 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from '../utils/griddleConnect';
import compose from 'recompose/compose';
import mapProps from 'recompose/mapProps';
import getContext from 'recompose/getContext';
//import { visibleRowIdsSelector, classNamesForComponentSelector, stylesForComponentSelector } from '../selectors/dataSelectors';
const ComposedTableBodyContainer = OriginalComponent => compose(
getContext({
components: PropTypes.object,
selectors: PropTypes.object,
}),
connect(
(state, props) => ({
visibleRowIds: props.selectors.visibleRowIdsSelector(state),
className: props.selectors.classNamesForComponentSelector(state, 'TableBody'),
style: props.selectors.stylesForComponentSelector(state, 'TableBody'),
})
),
mapProps(props => {
const { components, selectors, ...otherProps } = props;
return {
Row: props.components.Row,
...otherProps,
};
}),
)(({Row, visibleRowIds, style, className}) => (
<OriginalComponent
rowIds={visibleRowIds}
Row={Row}
style={style}
className={className}
/>
));
export default ComposedTableBodyContainer;