Sha256: d1ff987b49c4f9d766591d992607e9df2b38068c32a6c9097fb5950b99d343df
Contents?: true
Size: 1.23 KB
Versions: 40
Compression:
Stored size: 1.23 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { Alert, Button } from 'patternfly-react'; import { sprintf, translate as __ } from 'foremanReact/common/I18n'; export const SelectAllAlert = ({ itemCount, perPage, selectAllRows, unselectAllRows, allRowsSelected, }) => { const selectAllText = ( <React.Fragment> {sprintf( 'All %s tasks on this page are selected', Math.min(itemCount, perPage) )} <Button bsStyle="link" onClick={selectAllRows}> {__('Select All')} <b> {itemCount} </b> {__('tasks.')} </Button> </React.Fragment> ); const undoSelectText = ( <React.Fragment> {sprintf(__(`All %s tasks are selected. `), itemCount)} <Button bsStyle="link" onClick={unselectAllRows}> {__('Undo selection')} </Button> </React.Fragment> ); const selectAlertText = allRowsSelected ? undoSelectText : selectAllText; return <Alert type="info">{selectAlertText}</Alert>; }; SelectAllAlert.propTypes = { allRowsSelected: PropTypes.bool.isRequired, itemCount: PropTypes.number.isRequired, perPage: PropTypes.number.isRequired, selectAllRows: PropTypes.func.isRequired, unselectAllRows: PropTypes.func.isRequired, };
Version data entries
40 entries across 40 versions & 1 rubygems