2019-05-07 07:18:48 +00:00
|
|
|
/** @format */
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __, sprintf } from '@wordpress/i18n';
|
2019-05-20 20:50:25 +00:00
|
|
|
import { isNil } from 'lodash';
|
2019-05-07 07:18:48 +00:00
|
|
|
|
|
|
|
function HistoricalDataProgress( { label, progress, total } ) {
|
2019-05-20 20:50:25 +00:00
|
|
|
const labelText = sprintf( __( 'Imported %(label)s', 'woocommerce-admin' ), {
|
|
|
|
label,
|
|
|
|
} );
|
|
|
|
|
|
|
|
const labelCounters =
|
|
|
|
! isNil( progress ) && ! isNil( total )
|
|
|
|
? sprintf( __( '%(progress)s of %(total)s', 'woocommerce-admin' ), {
|
|
|
|
progress,
|
|
|
|
total,
|
|
|
|
} )
|
|
|
|
: null;
|
|
|
|
|
2019-05-07 07:18:48 +00:00
|
|
|
return (
|
|
|
|
<div className="woocommerce-settings-historical-data__progress">
|
2019-05-20 20:50:25 +00:00
|
|
|
<span className="woocommerce-settings-historical-data__progress-label">{ labelText }</span>
|
|
|
|
{ labelCounters && (
|
|
|
|
<span className="woocommerce-settings-historical-data__progress-label">
|
|
|
|
{ labelCounters }
|
|
|
|
</span>
|
|
|
|
) }
|
2019-05-07 07:18:48 +00:00
|
|
|
<progress
|
|
|
|
className="woocommerce-settings-historical-data__progress-bar"
|
|
|
|
max={ total }
|
|
|
|
value={ progress }
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default HistoricalDataProgress;
|