PluginProbe
ElasticPress / 4.6.0
ElasticPress v4.6.0
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / assets / js / sync / components / common / progress-bar.js

progress-bar.js in ElasticPress 4.6.0, at assets/js/sync/components/common/progress-bar.js

42 lines 1004 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * External dependencies.
3 */
4 import classnames from 'classnames';
5
6 /**
7 * WordPress dependencies.
8 */
9 import { WPElement } from '@wordpress/element';
10
11 /**
12 * Progress bar component.
13 *
14 * @param {object} props Component props.
15 * @param {number} props.current Current value.
16 * @param {number} props.total Current total.
17 * @param {boolean} props.isComplete If operation is complete.
18 * @param {boolean} props.isFailed If sync has failed.
19 * @returns {WPElement} Component.
20 */
21 export default ({ isComplete, isFailed, current, total }) => {
22 const now = total ? Math.floor((current / total) * 100) : 100;
23
24 return (
25 <div
26 aria-valuemax={100}
27 aria-valuemin={0}
28 aria-valuenow={now}
29 className={classnames('ep-sync-progress-bar', {
30 'ep-sync-progress-bar--complete': isComplete,
31 'ep-sync-progress-bar--failed': isFailed,
32 })}
33 role="progressbar"
34 >
35 <div
36 className="ep-sync-progress-bar__progress"
37 style={{ minWidth: `${now}%` }}
38 >{`${now}%`}</div>
39 </div>
40 );
41 };
42