Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 11x 11x 11x 20x 1x 1x 5x 5x 11x 1x 5x 11x | import React, { Component, Fragment } from "react"; import { connect } from "react-redux"; import { IconButton, Tooltip, Zoom } from "@material-ui/core"; import { selectionIconsPropType, rowsSelectedPropType, setRowsSelectedPropType } from "../../../proptypes"; import { setRowsSelected as setRowsSelectedAction } from "../../../redux/actions/datatableActions"; class SelectionIcons extends Component { render() { const { rowsSelected, selectionIcons, setRowsSelected } = this.props; const disabled = rowsSelected.length === 0; return ( <Fragment> {selectionIcons.map((icon, i) => ( <Tooltip key={icon.title} TransitionComponent={Zoom} title={disabled ? "0 row selected" : icon.title} > <span> <IconButton className={ disabled ? `disabled-icon selection-icon-${i}` : `selection-icon-${i}` } onClick={() => { icon.onClick(rowsSelected); setRowsSelected(); }} disabled={disabled} > {icon.icon} </IconButton> </span> </Tooltip> ))} </Fragment> ); } } SelectionIcons.propTypes = { rowsSelected: rowsSelectedPropType.isRequired, selectionIcons: selectionIconsPropType.isRequired, setRowsSelected: setRowsSelectedPropType }; const mapDispatchToProps = dispatch => { return { setRowsSelected: () => dispatch(setRowsSelectedAction([])) }; }; const mapStateToProps = state => { return { rowsSelected: state.datatableReducer.rowsSelected, selectionIcons: state.datatableReducer.features.selectionIcons }; }; export default connect( mapStateToProps, mapDispatchToProps )(SelectionIcons); |